/*!--------------------------------------------------------
 * 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 __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));

// node_modules/minimist/index.js
var require_minimist = __commonJS({
  "node_modules/minimist/index.js"(exports2, module2) {
    "use strict";
    function hasKey(obj, keys) {
      var o = obj;
      keys.slice(0, -1).forEach(function(key2) {
        o = o[key2] || {};
      });
      var key = keys[keys.length - 1];
      return key in o;
    }
    function isNumber2(x) {
      if (typeof x === "number") {
        return true;
      }
      if (/^0x[0-9a-f]+$/i.test(x)) {
        return true;
      }
      return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
    }
    function isConstructorOrProto(obj, key) {
      return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
    }
    module2.exports = function(args, opts) {
      if (!opts) {
        opts = {};
      }
      var flags = {
        bools: {},
        strings: {},
        unknownFn: null
      };
      if (typeof opts.unknown === "function") {
        flags.unknownFn = opts.unknown;
      }
      if (typeof opts.boolean === "boolean" && opts.boolean) {
        flags.allBools = true;
      } else {
        [].concat(opts.boolean).filter(Boolean).forEach(function(key2) {
          flags.bools[key2] = true;
        });
      }
      var aliases = {};
      function aliasIsBoolean(key2) {
        return aliases[key2].some(function(x) {
          return flags.bools[x];
        });
      }
      Object.keys(opts.alias || {}).forEach(function(key2) {
        aliases[key2] = [].concat(opts.alias[key2]);
        aliases[key2].forEach(function(x) {
          aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
            return x !== y;
          }));
        });
      });
      [].concat(opts.string).filter(Boolean).forEach(function(key2) {
        flags.strings[key2] = true;
        if (aliases[key2]) {
          [].concat(aliases[key2]).forEach(function(k) {
            flags.strings[k] = true;
          });
        }
      });
      var defaults = opts.default || {};
      var argv = { _: [] };
      function argDefined(key2, arg2) {
        return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
      }
      function setKey(obj, keys, value2) {
        var o = obj;
        for (var i2 = 0; i2 < keys.length - 1; i2++) {
          var key2 = keys[i2];
          if (isConstructorOrProto(o, key2)) {
            return;
          }
          if (o[key2] === void 0) {
            o[key2] = {};
          }
          if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) {
            o[key2] = {};
          }
          if (o[key2] === Array.prototype) {
            o[key2] = [];
          }
          o = o[key2];
        }
        var lastKey = keys[keys.length - 1];
        if (isConstructorOrProto(o, lastKey)) {
          return;
        }
        if (o === Object.prototype || o === Number.prototype || o === String.prototype) {
          o = {};
        }
        if (o === Array.prototype) {
          o = [];
        }
        if (o[lastKey] === void 0 || flags.bools[lastKey] || typeof o[lastKey] === "boolean") {
          o[lastKey] = value2;
        } else if (Array.isArray(o[lastKey])) {
          o[lastKey].push(value2);
        } else {
          o[lastKey] = [o[lastKey], value2];
        }
      }
      function setArg(key2, val, arg2) {
        if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
          if (flags.unknownFn(arg2) === false) {
            return;
          }
        }
        var value2 = !flags.strings[key2] && isNumber2(val) ? Number(val) : val;
        setKey(argv, key2.split("."), value2);
        (aliases[key2] || []).forEach(function(x) {
          setKey(argv, x.split("."), value2);
        });
      }
      Object.keys(flags.bools).forEach(function(key2) {
        setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
      });
      var notFlags = [];
      if (args.indexOf("--") !== -1) {
        notFlags = args.slice(args.indexOf("--") + 1);
        args = args.slice(0, args.indexOf("--"));
      }
      for (var i = 0; i < args.length; i++) {
        var arg = args[i];
        var key;
        var next;
        if (/^--.+=/.test(arg)) {
          var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
          key = m[1];
          var value = m[2];
          if (flags.bools[key]) {
            value = value !== "false";
          }
          setArg(key, value, arg);
        } else if (/^--no-.+/.test(arg)) {
          key = arg.match(/^--no-(.+)/)[1];
          setArg(key, false, arg);
        } else if (/^--.+/.test(arg)) {
          key = arg.match(/^--(.+)/)[1];
          next = args[i + 1];
          if (next !== void 0 && !/^(-|--)[^-]/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
            setArg(key, next, arg);
            i += 1;
          } else if (/^(true|false)$/.test(next)) {
            setArg(key, next === "true", arg);
            i += 1;
          } else {
            setArg(key, flags.strings[key] ? "" : true, arg);
          }
        } else if (/^-[^-]+/.test(arg)) {
          var letters = arg.slice(1, -1).split("");
          var broken = false;
          for (var j = 0; j < letters.length; j++) {
            next = arg.slice(j + 2);
            if (next === "-") {
              setArg(letters[j], next, arg);
              continue;
            }
            if (/[A-Za-z]/.test(letters[j]) && next[0] === "=") {
              setArg(letters[j], next.slice(1), arg);
              broken = true;
              break;
            }
            if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
              setArg(letters[j], next, arg);
              broken = true;
              break;
            }
            if (letters[j + 1] && letters[j + 1].match(/\W/)) {
              setArg(letters[j], arg.slice(j + 2), arg);
              broken = true;
              break;
            } else {
              setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
            }
          }
          key = arg.slice(-1)[0];
          if (!broken && key !== "-") {
            if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
              setArg(key, args[i + 1], arg);
              i += 1;
            } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
              setArg(key, args[i + 1] === "true", arg);
              i += 1;
            } else {
              setArg(key, flags.strings[key] ? "" : true, arg);
            }
          }
        } else {
          if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
            argv._.push(flags.strings._ || !isNumber2(arg) ? arg : Number(arg));
          }
          if (opts.stopEarly) {
            argv._.push.apply(argv._, args.slice(i + 1));
            break;
          }
        }
      }
      Object.keys(defaults).forEach(function(k) {
        if (!hasKey(argv, k.split("."))) {
          setKey(argv, k.split("."), defaults[k]);
          (aliases[k] || []).forEach(function(x) {
            setKey(argv, x.split("."), defaults[k]);
          });
        }
      });
      if (opts["--"]) {
        argv["--"] = notFlags.slice();
      } else {
        notFlags.forEach(function(k) {
          argv._.push(k);
        });
      }
      return argv;
    };
  }
});

// out-build/vs/base/common/performance.js
function _definePolyfillMarks(timeOrigin) {
  const _data = [];
  if (typeof timeOrigin === "number") {
    _data.push("code/timeOrigin", timeOrigin);
  }
  function mark(name, markOptions) {
    _data.push(name, markOptions?.startTime ?? Date.now());
  }
  function getMarks() {
    const result = [];
    for (let i = 0; i < _data.length; i += 2) {
      result.push({
        name: _data[i],
        startTime: _data[i + 1]
      });
    }
    return result;
  }
  return { mark, getMarks };
}
function _define() {
  if (typeof performance === "object" && typeof performance.mark === "function" && !performance.nodeTiming) {
    if (typeof performance.timeOrigin !== "number" && !performance.timing) {
      return _definePolyfillMarks();
    } else {
      return {
        mark(name, markOptions) {
          performance.mark(name, markOptions);
        },
        getMarks() {
          let timeOrigin = performance.timeOrigin;
          if (typeof timeOrigin !== "number") {
            timeOrigin = performance.timing.navigationStart || performance.timing.redirectStart || performance.timing.fetchStart;
          }
          const result = [{ name: "code/timeOrigin", startTime: Math.round(timeOrigin) }];
          for (const entry of performance.getEntriesByType("mark")) {
            result.push({
              name: entry.name,
              startTime: Math.round(timeOrigin + entry.startTime)
            });
          }
          return result;
        }
      };
    }
  } else if (typeof process === "object") {
    const timeOrigin = performance?.timeOrigin;
    return _definePolyfillMarks(timeOrigin);
  } else {
    console.trace("perf-util loaded in UNKNOWN environment");
    return _definePolyfillMarks();
  }
}
function _factory(sharedObj) {
  if (!sharedObj.MonacoPerformanceMarks) {
    sharedObj.MonacoPerformanceMarks = _define();
  }
  return sharedObj.MonacoPerformanceMarks;
}
var perf, $S, $T;
var init_performance = __esm({
  "out-build/vs/base/common/performance.js"() {
    "use strict";
    perf = _factory(globalThis);
    $S = perf.mark;
    $T = perf.getMarks;
  }
});

// out-build/vs/base/node/nls.js
import * as path3 from "path";
import * as fs3 from "fs";
async function $Os({ userLocale, osLocale, userDataPath, commit, nlsMetadataPath: nlsMetadataPath2 }) {
  $S("code/willGenerateNls");
  if (process.env["VSCODE_DEV"] || userLocale === "pseudo" || userLocale.startsWith("en") || !commit || !userDataPath) {
    return defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath2);
  }
  try {
    const languagePacks = await getLanguagePackConfigurations(userDataPath);
    if (!languagePacks) {
      return defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath2);
    }
    const resolvedLanguage = resolveLanguagePackLanguage(languagePacks, userLocale);
    if (!resolvedLanguage) {
      return defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath2);
    }
    const languagePack = languagePacks[resolvedLanguage];
    const mainLanguagePackPath = languagePack?.translations?.["vscode"];
    if (!languagePack || typeof languagePack.hash !== "string" || !languagePack.translations || typeof mainLanguagePackPath !== "string" || !await exists(mainLanguagePackPath)) {
      return defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath2);
    }
    const languagePackId = `${languagePack.hash}.${resolvedLanguage}`;
    const globalLanguagePackCachePath = path3.join(userDataPath, "clp", languagePackId);
    const commitLanguagePackCachePath = path3.join(globalLanguagePackCachePath, commit);
    const languagePackMessagesFile = path3.join(commitLanguagePackCachePath, "nls.messages.json");
    const translationsConfigFile = path3.join(globalLanguagePackCachePath, "tcf.json");
    const languagePackCorruptMarkerFile = path3.join(globalLanguagePackCachePath, "corrupted.info");
    if (await exists(languagePackCorruptMarkerFile)) {
      await fs3.promises.rm(globalLanguagePackCachePath, { recursive: true, force: true, maxRetries: 3 });
    }
    const result = {
      userLocale,
      osLocale,
      resolvedLanguage,
      defaultMessagesFile: path3.join(nlsMetadataPath2, "nls.messages.json"),
      languagePack: {
        translationsConfigFile,
        messagesFile: languagePackMessagesFile,
        corruptMarkerFile: languagePackCorruptMarkerFile
      },
      // NLS: below properties are a relic from old times only used by vscode-nls and deprecated
      locale: userLocale,
      availableLanguages: { "*": resolvedLanguage },
      _languagePackId: languagePackId,
      _languagePackSupport: true,
      _translationsConfigFile: translationsConfigFile,
      _cacheRoot: globalLanguagePackCachePath,
      _resolvedLanguagePackCoreLocation: commitLanguagePackCachePath,
      _corruptedFile: languagePackCorruptMarkerFile
    };
    if (await exists(commitLanguagePackCachePath)) {
      touch(commitLanguagePackCachePath).catch(() => {
      });
      $S("code/didGenerateNls");
      return result;
    }
    const [, nlsDefaultKeys, nlsDefaultMessages, nlsPackdata] = await Promise.all([
      fs3.promises.mkdir(commitLanguagePackCachePath, { recursive: true }),
      JSON.parse(await fs3.promises.readFile(path3.join(nlsMetadataPath2, "nls.keys.json"), "utf-8")),
      JSON.parse(await fs3.promises.readFile(path3.join(nlsMetadataPath2, "nls.messages.json"), "utf-8")),
      JSON.parse(await fs3.promises.readFile(mainLanguagePackPath, "utf-8"))
    ]);
    const nlsResult = [];
    let nlsIndex = 0;
    for (const [moduleId, nlsKeys] of nlsDefaultKeys) {
      const moduleTranslations = nlsPackdata.contents[moduleId];
      for (const nlsKey of nlsKeys) {
        nlsResult.push(moduleTranslations?.[nlsKey] || nlsDefaultMessages[nlsIndex]);
        nlsIndex++;
      }
    }
    await Promise.all([
      fs3.promises.writeFile(languagePackMessagesFile, JSON.stringify(nlsResult), "utf-8"),
      fs3.promises.writeFile(translationsConfigFile, JSON.stringify(languagePack.translations), "utf-8")
    ]);
    $S("code/didGenerateNls");
    return result;
  } catch (error) {
    console.error("Generating translation files failed.", error);
  }
  return defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath2);
}
async function getLanguagePackConfigurations(userDataPath) {
  const configFile = path3.join(userDataPath, "languagepacks.json");
  try {
    return JSON.parse(await fs3.promises.readFile(configFile, "utf-8"));
  } catch (err) {
    return void 0;
  }
}
function resolveLanguagePackLanguage(languagePacks, locale) {
  try {
    while (locale) {
      if (languagePacks[locale]) {
        return locale;
      }
      const index = locale.lastIndexOf("-");
      if (index > 0) {
        locale = locale.substring(0, index);
      } else {
        return void 0;
      }
    }
  } catch (error) {
    console.error("Resolving language pack configuration failed.", error);
  }
  return void 0;
}
function defaultNLSConfiguration(userLocale, osLocale, nlsMetadataPath2) {
  $S("code/didGenerateNls");
  return {
    userLocale,
    osLocale,
    resolvedLanguage: "en",
    defaultMessagesFile: path3.join(nlsMetadataPath2, "nls.messages.json"),
    // NLS: below 2 are a relic from old times only used by vscode-nls and deprecated
    locale: userLocale,
    availableLanguages: {}
  };
}
async function exists(path7) {
  try {
    await fs3.promises.access(path7);
    return true;
  } catch {
    return false;
  }
}
function touch(path7) {
  const date = /* @__PURE__ */ new Date();
  return fs3.promises.utimes(path7, date, date);
}
var init_nls = __esm({
  "out-build/vs/base/node/nls.js"() {
    "use strict";
    init_performance();
  }
});

// out-build/vs/base/common/errors.js
function setUnexpectedErrorHandler(newUnexpectedErrorHandler) {
  $cb.setUnexpectedErrorHandler(newUnexpectedErrorHandler);
}
function $eb(e) {
  if (!e || typeof e !== "object") {
    return false;
  }
  const cast = e;
  return cast.code === "EPIPE" && cast.syscall?.toUpperCase() === "WRITE";
}
function $fb(e) {
  $cb.onUnexpectedError(e);
  return void 0;
}
function $gb(e) {
  if (!$kb(e)) {
    $cb.onUnexpectedError(e);
  }
  return void 0;
}
function $kb(error) {
  if (error instanceof $lb) {
    return true;
  }
  return error instanceof Error && error.name === canceledName && error.message === canceledName;
}
function $mb() {
  const error = new Error(canceledName);
  error.name = error.message;
  return error;
}
function $nb(name) {
  if (name) {
    return new Error(`Illegal argument: ${name}`);
  } else {
    return new Error("Illegal argument");
  }
}
function $ob(name) {
  if (name) {
    return new Error(`Illegal state: ${name}`);
  } else {
    return new Error("Illegal state");
  }
}
function $qb(err) {
  if (!err) {
    return "Error";
  }
  if (err.message) {
    return err.message;
  }
  if (err.stack) {
    return err.stack.split("\n")[0];
  }
  return String(err);
}
var $bb, $cb, canceledName, $lb, $ub, $vb;
var init_errors = __esm({
  "out-build/vs/base/common/errors.js"() {
    "use strict";
    $bb = class {
      constructor() {
        this.b = [];
        this.a = function(e) {
          setTimeout(() => {
            if (e.stack) {
              if ($ub.isErrorNoTelemetry(e)) {
                throw new $ub(e.message + "\n\n" + e.stack);
              }
              throw new Error(e.message + "\n\n" + e.stack);
            }
            throw e;
          }, 0);
        };
      }
      addListener(listener) {
        this.b.push(listener);
        return () => {
          this.d(listener);
        };
      }
      c(e) {
        this.b.forEach((listener) => {
          listener(e);
        });
      }
      d(listener) {
        this.b.splice(this.b.indexOf(listener), 1);
      }
      setUnexpectedErrorHandler(newUnexpectedErrorHandler) {
        this.a = newUnexpectedErrorHandler;
      }
      getUnexpectedErrorHandler() {
        return this.a;
      }
      onUnexpectedError(e) {
        this.a(e);
        this.c(e);
      }
      // For external errors, we don't want the listeners to be called
      onUnexpectedExternalError(e) {
        this.a(e);
      }
    };
    $cb = new $bb();
    canceledName = "Canceled";
    $lb = class extends Error {
      constructor() {
        super(canceledName);
        this.name = this.message;
      }
    };
    $ub = class _$ub extends Error {
      constructor(msg) {
        super(msg);
        this.name = "CodeExpectedError";
      }
      static fromError(err) {
        if (err instanceof _$ub) {
          return err;
        }
        const result = new _$ub();
        result.message = err.message;
        result.stack = err.stack;
        return result;
      }
      static isErrorNoTelemetry(err) {
        return err.name === "CodeExpectedError";
      }
    };
    $vb = class _$vb extends Error {
      constructor(message) {
        super(message || "An unexpected bug occurred.");
        Object.setPrototypeOf(this, _$vb.prototype);
      }
    };
  }
});

// out-build/vs/nls.messages.js
function $f() {
  return globalThis._VSCODE_NLS_MESSAGES;
}
function $g() {
  return globalThis._VSCODE_NLS_LANGUAGE;
}
var init_nls_messages = __esm({
  "out-build/vs/nls.messages.js"() {
    "use strict";
  }
});

// out-build/vs/nls.js
function _format(message, args) {
  let result;
  if (args.length === 0) {
    result = message;
  } else {
    result = message.replace(/\{(\d+)\}/g, (match, rest) => {
      const index = rest[0];
      const arg = args[index];
      let result2 = match;
      if (typeof arg === "string") {
        result2 = arg;
      } else if (typeof arg === "number" || typeof arg === "boolean" || arg === void 0 || arg === null) {
        result2 = String(arg);
      }
      return result2;
    });
  }
  if (isPseudo) {
    result = "\uFF3B" + result.replace(/[aouei]/g, "$&$&") + "\uFF3D";
  }
  return result;
}
function localize(data, message, ...args) {
  if (typeof data === "number") {
    return _format(lookupMessage(data, message), args);
  }
  return _format(message, args);
}
function lookupMessage(index, fallback) {
  const message = $f()?.[index];
  if (typeof message !== "string") {
    if (typeof fallback === "string") {
      return fallback;
    }
    throw new Error(`!!! NLS MISSING: ${index} !!!`);
  }
  return message;
}
function localize2(data, originalMessage, ...args) {
  let message;
  if (typeof data === "number") {
    message = lookupMessage(data, originalMessage);
  } else {
    message = originalMessage;
  }
  const value = _format(message, args);
  return {
    value,
    original: originalMessage === message ? value : _format(originalMessage, args)
  };
}
var isPseudo;
var init_nls2 = __esm({
  "out-build/vs/nls.js"() {
    "use strict";
    init_nls_messages();
    init_nls_messages();
    isPseudo = $g() === "pseudo" || typeof document !== "undefined" && document.location && typeof document.location.hash === "string" && document.location.hash.indexOf("pseudo=true") >= 0;
  }
});

// out-build/vs/base/common/platform.js
function $k(platform) {
  switch (platform) {
    case 0:
      return "Web";
    case 1:
      return "Mac";
    case 2:
      return "Linux";
    case 3:
      return "Windows";
  }
}
var $j, _isWindows, _isMacintosh, _isLinux, _isLinuxSnap, _isNative, _isWeb, _isElectron, _isIOS, _isCI, _isMobile, _locale, _language, _platformLocale, _translationsConfigFile, _userAgent, $globalThis, nodeProcess, isElectronProcess, isElectronRenderer, Platform, _platform, $l, $m, $n, $o, $p, $r, $s, $t, $x, $y, $z, Language, $D, $E, OperatingSystem, OS, $H, $I, $J, $K, $L;
var init_platform = __esm({
  "out-build/vs/base/common/platform.js"() {
    "use strict";
    init_nls2();
    $j = "en";
    _isWindows = false;
    _isMacintosh = false;
    _isLinux = false;
    _isLinuxSnap = false;
    _isNative = false;
    _isWeb = false;
    _isElectron = false;
    _isIOS = false;
    _isCI = false;
    _isMobile = false;
    _locale = void 0;
    _language = $j;
    _platformLocale = $j;
    _translationsConfigFile = void 0;
    _userAgent = void 0;
    $globalThis = globalThis;
    nodeProcess = void 0;
    if (typeof $globalThis.vscode !== "undefined" && typeof $globalThis.vscode.process !== "undefined") {
      nodeProcess = $globalThis.vscode.process;
    } else if (typeof process !== "undefined" && typeof process?.versions?.node === "string") {
      nodeProcess = process;
    }
    isElectronProcess = typeof nodeProcess?.versions?.electron === "string";
    isElectronRenderer = isElectronProcess && nodeProcess?.type === "renderer";
    if (typeof nodeProcess === "object") {
      _isWindows = nodeProcess.platform === "win32";
      _isMacintosh = nodeProcess.platform === "darwin";
      _isLinux = nodeProcess.platform === "linux";
      _isLinuxSnap = _isLinux && !!nodeProcess.env["SNAP"] && !!nodeProcess.env["SNAP_REVISION"];
      _isElectron = isElectronProcess;
      _isCI = !!nodeProcess.env["CI"] || !!nodeProcess.env["BUILD_ARTIFACTSTAGINGDIRECTORY"];
      _locale = $j;
      _language = $j;
      const rawNlsConfig = nodeProcess.env["VSCODE_NLS_CONFIG"];
      if (rawNlsConfig) {
        try {
          const nlsConfig = JSON.parse(rawNlsConfig);
          _locale = nlsConfig.userLocale;
          _platformLocale = nlsConfig.osLocale;
          _language = nlsConfig.resolvedLanguage || $j;
          _translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;
        } catch (e) {
        }
      }
      _isNative = true;
    } else if (typeof navigator === "object" && !isElectronRenderer) {
      _userAgent = navigator.userAgent;
      _isWindows = _userAgent.indexOf("Windows") >= 0;
      _isMacintosh = _userAgent.indexOf("Macintosh") >= 0;
      _isIOS = (_userAgent.indexOf("Macintosh") >= 0 || _userAgent.indexOf("iPad") >= 0 || _userAgent.indexOf("iPhone") >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;
      _isLinux = _userAgent.indexOf("Linux") >= 0;
      _isMobile = _userAgent?.indexOf("Mobi") >= 0;
      _isWeb = true;
      _language = $g() || $j;
      _locale = navigator.language.toLowerCase();
      _platformLocale = _locale;
    } else {
      console.error("Unable to resolve platform.");
    }
    (function(Platform2) {
      Platform2[Platform2["Web"] = 0] = "Web";
      Platform2[Platform2["Mac"] = 1] = "Mac";
      Platform2[Platform2["Linux"] = 2] = "Linux";
      Platform2[Platform2["Windows"] = 3] = "Windows";
    })(Platform || (Platform = {}));
    _platform = 0;
    if (_isMacintosh) {
      _platform = 1;
    } else if (_isWindows) {
      _platform = 3;
    } else if (_isLinux) {
      _platform = 2;
    }
    $l = _isWindows;
    $m = _isMacintosh;
    $n = _isLinux;
    $o = _isLinuxSnap;
    $p = _isNative;
    $r = _isWeb;
    $s = _isWeb && typeof $globalThis.importScripts === "function";
    $t = $s ? $globalThis.origin : void 0;
    $x = _platform;
    $y = _userAgent;
    $z = _language;
    (function(Language2) {
      function value() {
        return $z;
      }
      Language2.value = value;
      function isDefaultVariant() {
        if ($z.length === 2) {
          return $z === "en";
        } else if ($z.length >= 3) {
          return $z[0] === "e" && $z[1] === "n" && $z[2] === "-";
        } else {
          return false;
        }
      }
      Language2.isDefaultVariant = isDefaultVariant;
      function isDefault() {
        return $z === "en";
      }
      Language2.isDefault = isDefault;
    })(Language || (Language = {}));
    $D = typeof $globalThis.postMessage === "function" && !$globalThis.importScripts;
    $E = (() => {
      if ($D) {
        const pending = [];
        $globalThis.addEventListener("message", (e) => {
          if (e.data && e.data.vscodeScheduleAsyncWork) {
            for (let i = 0, len = pending.length; i < len; i++) {
              const candidate = pending[i];
              if (candidate.id === e.data.vscodeScheduleAsyncWork) {
                pending.splice(i, 1);
                candidate.callback();
                return;
              }
            }
          }
        });
        let lastId = 0;
        return (callback) => {
          const myId = ++lastId;
          pending.push({
            id: myId,
            callback
          });
          $globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, "*");
        };
      }
      return (callback) => setTimeout(callback);
    })();
    (function(OperatingSystem2) {
      OperatingSystem2[OperatingSystem2["Windows"] = 1] = "Windows";
      OperatingSystem2[OperatingSystem2["Macintosh"] = 2] = "Macintosh";
      OperatingSystem2[OperatingSystem2["Linux"] = 3] = "Linux";
    })(OperatingSystem || (OperatingSystem = {}));
    OS = _isMacintosh || _isIOS ? 2 : _isWindows ? 1 : 3;
    $H = !!($y && $y.indexOf("Chrome") >= 0);
    $I = !!($y && $y.indexOf("Firefox") >= 0);
    $J = !!(!$H && ($y && $y.indexOf("Safari") >= 0));
    $K = !!($y && $y.indexOf("Edg/") >= 0);
    $L = !!($y && $y.indexOf("Android") >= 0);
  }
});

// out-build/vs/base/common/collections.js
function $a(data, groupFn) {
  const result = /* @__PURE__ */ Object.create(null);
  for (const element of data) {
    const key = groupFn(element);
    let target = result[key];
    if (!target) {
      target = result[key] = [];
    }
    target.push(element);
  }
  return result;
}
var _a, $e;
var init_collections = __esm({
  "out-build/vs/base/common/collections.js"() {
    "use strict";
    $e = class {
      static {
        _a = Symbol.toStringTag;
      }
      constructor(values, b) {
        this.b = b;
        this.a = /* @__PURE__ */ new Map();
        this[_a] = "SetWithKey";
        for (const value of values) {
          this.add(value);
        }
      }
      get size() {
        return this.a.size;
      }
      add(value) {
        const key = this.b(value);
        this.a.set(key, value);
        return this;
      }
      delete(value) {
        return this.a.delete(this.b(value));
      }
      has(value) {
        return this.a.has(this.b(value));
      }
      *entries() {
        for (const entry of this.a.values()) {
          yield [entry, entry];
        }
      }
      keys() {
        return this.values();
      }
      *values() {
        for (const entry of this.a.values()) {
          yield entry;
        }
      }
      clear() {
        this.a.clear();
      }
      forEach(callbackfn, thisArg) {
        this.a.forEach((entry) => callbackfn.call(thisArg, entry, entry, this));
      }
      [Symbol.iterator]() {
        return this.values();
      }
    };
  }
});

// out-build/vs/base/common/functional.js
function $Qc(fn, fnDidRunCallback) {
  const _this = this;
  let didCall = false;
  let result;
  return function() {
    if (didCall) {
      return result;
    }
    didCall = true;
    if (fnDidRunCallback) {
      try {
        result = fn.apply(_this, arguments);
      } finally {
        fnDidRunCallback();
      }
    } else {
      result = fn.apply(_this, arguments);
    }
    return result;
  };
}
var init_functional = __esm({
  "out-build/vs/base/common/functional.js"() {
    "use strict";
  }
});

// out-build/vs/base/common/arraysFind.js
function $1(array, predicate) {
  const idx = $2(array, predicate);
  if (idx === -1) {
    return void 0;
  }
  return array[idx];
}
function $2(array, predicate, fromIndex = array.length - 1) {
  for (let i = fromIndex; i >= 0; i--) {
    const element = array[i];
    if (predicate(element)) {
      return i;
    }
  }
  return -1;
}
function $4(array, predicate, startIdx = 0, endIdxEx = array.length) {
  let i = startIdx;
  let j = endIdxEx;
  while (i < j) {
    const k = Math.floor((i + j) / 2);
    if (predicate(array[k])) {
      i = k + 1;
    } else {
      j = k;
    }
  }
  return i - 1;
}
var $8;
var init_arraysFind = __esm({
  "out-build/vs/base/common/arraysFind.js"() {
    "use strict";
    $8 = class _$8 {
      static {
        this.assertInvariants = false;
      }
      constructor(e) {
        this.e = e;
        this.c = 0;
      }
      /**
       * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!
       * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`.
       */
      findLastMonotonous(predicate) {
        if (_$8.assertInvariants) {
          if (this.d) {
            for (const item of this.e) {
              if (this.d(item) && !predicate(item)) {
                throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.");
              }
            }
          }
          this.d = predicate;
        }
        const idx = $4(this.e, predicate, this.c);
        this.c = idx + 1;
        return idx === -1 ? void 0 : this.e[idx];
      }
    };
  }
});

// out-build/vs/base/common/arrays.js
function $zb(one, other, itemEquals = (a, b) => a === b) {
  if (one === other) {
    return true;
  }
  if (!one || !other) {
    return false;
  }
  if (one.length !== other.length) {
    return false;
  }
  for (let i = 0, len = one.length; i < len; i++) {
    if (!itemEquals(one[i], other[i])) {
      return false;
    }
  }
  return true;
}
function $Bb(array, key, comparator) {
  return $Cb(array.length, (i) => comparator(array[i], key));
}
function $Cb(length, compareToKey) {
  let low = 0, high = length - 1;
  while (low <= high) {
    const mid = (low + high) / 2 | 0;
    const comp = compareToKey(mid);
    if (comp < 0) {
      low = mid + 1;
    } else if (comp > 0) {
      high = mid - 1;
    } else {
      return mid;
    }
  }
  return -(low + 1);
}
function $Mb(array) {
  return array.filter((e) => !!e);
}
function $Nb(array) {
  let to = 0;
  for (let i = 0; i < array.length; i++) {
    if (!!array[i]) {
      array[to] = array[i];
      to += 1;
    }
  }
  array.length = to;
}
function $Qb(obj) {
  return Array.isArray(obj) && obj.length > 0;
}
function $Rb(array, keyFn = (value) => value) {
  const seen = /* @__PURE__ */ new Set();
  return array.filter((element) => {
    const key = keyFn(element);
    if (seen.has(key)) {
      return false;
    }
    seen.add(key);
    return true;
  });
}
function $Wb(array, element) {
  array.push(element);
  return () => $Xb(array, element);
}
function $Xb(array, element) {
  const index = array.indexOf(element);
  if (index > -1) {
    array.splice(index, 1);
    return element;
  }
  return void 0;
}
function $Zb(array, _seed) {
  let rand;
  if (typeof _seed === "number") {
    let seed = _seed;
    rand = () => {
      const x = Math.sin(seed++) * 179426549;
      return x - Math.floor(x);
    };
  } else {
    rand = Math.random;
  }
  for (let i = array.length - 1; i > 0; i -= 1) {
    const j = Math.floor(rand() * (i + 1));
    const temp = array[i];
    array[i] = array[j];
    array[j] = temp;
  }
}
function $5b(x) {
  return Array.isArray(x) ? x : [x];
}
function $6b(arr) {
  return arr[Math.floor(Math.random() * arr.length)];
}
function $9b(selector, comparator) {
  return (a, b) => comparator(selector(a), selector(b));
}
var CompareResult, $$b, $cc;
var init_arrays = __esm({
  "out-build/vs/base/common/arrays.js"() {
    "use strict";
    init_arraysFind();
    init_errors();
    (function(CompareResult2) {
      function isLessThan(result) {
        return result < 0;
      }
      CompareResult2.isLessThan = isLessThan;
      function isLessThanOrEqual(result) {
        return result <= 0;
      }
      CompareResult2.isLessThanOrEqual = isLessThanOrEqual;
      function isGreaterThan(result) {
        return result > 0;
      }
      CompareResult2.isGreaterThan = isGreaterThan;
      function isNeitherLessOrGreaterThan(result) {
        return result === 0;
      }
      CompareResult2.isNeitherLessOrGreaterThan = isNeitherLessOrGreaterThan;
      CompareResult2.greaterThan = 1;
      CompareResult2.lessThan = -1;
      CompareResult2.neitherLessOrGreaterThan = 0;
    })(CompareResult || (CompareResult = {}));
    $$b = (a, b) => a - b;
    $cc = class _$cc {
      static {
        this.empty = new _$cc((_callback) => {
        });
      }
      constructor(iterate) {
        this.iterate = iterate;
      }
      forEach(handler) {
        this.iterate((item) => {
          handler(item);
          return true;
        });
      }
      toArray() {
        const result = [];
        this.iterate((item) => {
          result.push(item);
          return true;
        });
        return result;
      }
      filter(predicate) {
        return new _$cc((cb) => this.iterate((item) => predicate(item) ? cb(item) : true));
      }
      map(mapFn) {
        return new _$cc((cb) => this.iterate((item) => cb(mapFn(item))));
      }
      some(predicate) {
        let result = false;
        this.iterate((item) => {
          result = predicate(item);
          return !result;
        });
        return result;
      }
      findFirst(predicate) {
        let result;
        this.iterate((item) => {
          if (predicate(item)) {
            result = item;
            return false;
          }
          return true;
        });
        return result;
      }
      findLast(predicate) {
        let result;
        this.iterate((item) => {
          if (predicate(item)) {
            result = item;
          }
          return true;
        });
        return result;
      }
      findLastMaxBy(comparator) {
        let result;
        let first = true;
        this.iterate((item) => {
          if (first || CompareResult.isGreaterThan(comparator(item, result))) {
            first = false;
            result = item;
          }
          return true;
        });
        return result;
      }
    };
  }
});

// out-build/vs/base/common/map.js
function isEntries(arg) {
  return Array.isArray(arg);
}
var _a2, _b, _c, ResourceMapEntry, $Ec, $Fc, Touch, $Gc, Cache, $Hc, $Lc;
var init_map = __esm({
  "out-build/vs/base/common/map.js"() {
    "use strict";
    ResourceMapEntry = class {
      constructor(uri, value) {
        this.uri = uri;
        this.value = value;
      }
    };
    $Ec = class _$Ec {
      static {
        this.c = (resource) => resource.toString();
      }
      constructor(arg, toKey) {
        this[_a2] = "ResourceMap";
        if (arg instanceof _$Ec) {
          this.d = new Map(arg.d);
          this.e = toKey ?? _$Ec.c;
        } else if (isEntries(arg)) {
          this.d = /* @__PURE__ */ new Map();
          this.e = toKey ?? _$Ec.c;
          for (const [resource, value] of arg) {
            this.set(resource, value);
          }
        } else {
          this.d = /* @__PURE__ */ new Map();
          this.e = arg ?? _$Ec.c;
        }
      }
      set(resource, value) {
        this.d.set(this.e(resource), new ResourceMapEntry(resource, value));
        return this;
      }
      get(resource) {
        return this.d.get(this.e(resource))?.value;
      }
      has(resource) {
        return this.d.has(this.e(resource));
      }
      get size() {
        return this.d.size;
      }
      clear() {
        this.d.clear();
      }
      delete(resource) {
        return this.d.delete(this.e(resource));
      }
      forEach(clb, thisArg) {
        if (typeof thisArg !== "undefined") {
          clb = clb.bind(thisArg);
        }
        for (const [_, entry] of this.d) {
          clb(entry.value, entry.uri, this);
        }
      }
      *values() {
        for (const entry of this.d.values()) {
          yield entry.value;
        }
      }
      *keys() {
        for (const entry of this.d.values()) {
          yield entry.uri;
        }
      }
      *entries() {
        for (const entry of this.d.values()) {
          yield [entry.uri, entry.value];
        }
      }
      *[(_a2 = Symbol.toStringTag, Symbol.iterator)]() {
        for (const [, entry] of this.d) {
          yield [entry.uri, entry.value];
        }
      }
    };
    $Fc = class {
      constructor(entriesOrKey, toKey) {
        this[_b] = "ResourceSet";
        if (!entriesOrKey || typeof entriesOrKey === "function") {
          this.c = new $Ec(entriesOrKey);
        } else {
          this.c = new $Ec(toKey);
          entriesOrKey.forEach(this.add, this);
        }
      }
      get size() {
        return this.c.size;
      }
      add(value) {
        this.c.set(value, value);
        return this;
      }
      clear() {
        this.c.clear();
      }
      delete(value) {
        return this.c.delete(value);
      }
      forEach(callbackfn, thisArg) {
        this.c.forEach((_value, key) => callbackfn.call(thisArg, key, key, this));
      }
      has(value) {
        return this.c.has(value);
      }
      entries() {
        return this.c.entries();
      }
      keys() {
        return this.c.keys();
      }
      values() {
        return this.c.keys();
      }
      [(_b = Symbol.toStringTag, Symbol.iterator)]() {
        return this.keys();
      }
    };
    (function(Touch2) {
      Touch2[Touch2["None"] = 0] = "None";
      Touch2[Touch2["AsOld"] = 1] = "AsOld";
      Touch2[Touch2["AsNew"] = 2] = "AsNew";
    })(Touch || (Touch = {}));
    $Gc = class {
      constructor() {
        this[_c] = "LinkedMap";
        this.c = /* @__PURE__ */ new Map();
        this.d = void 0;
        this.e = void 0;
        this.f = 0;
        this.g = 0;
      }
      clear() {
        this.c.clear();
        this.d = void 0;
        this.e = void 0;
        this.f = 0;
        this.g++;
      }
      isEmpty() {
        return !this.d && !this.e;
      }
      get size() {
        return this.f;
      }
      get first() {
        return this.d?.value;
      }
      get last() {
        return this.e?.value;
      }
      has(key) {
        return this.c.has(key);
      }
      get(key, touch2 = 0) {
        const item = this.c.get(key);
        if (!item) {
          return void 0;
        }
        if (touch2 !== 0) {
          this.m(item, touch2);
        }
        return item.value;
      }
      set(key, value, touch2 = 0) {
        let item = this.c.get(key);
        if (item) {
          item.value = value;
          if (touch2 !== 0) {
            this.m(item, touch2);
          }
        } else {
          item = { key, value, next: void 0, previous: void 0 };
          switch (touch2) {
            case 0:
              this.k(item);
              break;
            case 1:
              this.j(item);
              break;
            case 2:
              this.k(item);
              break;
            default:
              this.k(item);
              break;
          }
          this.c.set(key, item);
          this.f++;
        }
        return this;
      }
      delete(key) {
        return !!this.remove(key);
      }
      remove(key) {
        const item = this.c.get(key);
        if (!item) {
          return void 0;
        }
        this.c.delete(key);
        this.l(item);
        this.f--;
        return item.value;
      }
      shift() {
        if (!this.d && !this.e) {
          return void 0;
        }
        if (!this.d || !this.e) {
          throw new Error("Invalid list");
        }
        const item = this.d;
        this.c.delete(item.key);
        this.l(item);
        this.f--;
        return item.value;
      }
      forEach(callbackfn, thisArg) {
        const state = this.g;
        let current = this.d;
        while (current) {
          if (thisArg) {
            callbackfn.bind(thisArg)(current.value, current.key, this);
          } else {
            callbackfn(current.value, current.key, this);
          }
          if (this.g !== state) {
            throw new Error(`LinkedMap got modified during iteration.`);
          }
          current = current.next;
        }
      }
      keys() {
        const map = this;
        const state = this.g;
        let current = this.d;
        const iterator = {
          [Symbol.iterator]() {
            return iterator;
          },
          next() {
            if (map.g !== state) {
              throw new Error(`LinkedMap got modified during iteration.`);
            }
            if (current) {
              const result = { value: current.key, done: false };
              current = current.next;
              return result;
            } else {
              return { value: void 0, done: true };
            }
          }
        };
        return iterator;
      }
      values() {
        const map = this;
        const state = this.g;
        let current = this.d;
        const iterator = {
          [Symbol.iterator]() {
            return iterator;
          },
          next() {
            if (map.g !== state) {
              throw new Error(`LinkedMap got modified during iteration.`);
            }
            if (current) {
              const result = { value: current.value, done: false };
              current = current.next;
              return result;
            } else {
              return { value: void 0, done: true };
            }
          }
        };
        return iterator;
      }
      entries() {
        const map = this;
        const state = this.g;
        let current = this.d;
        const iterator = {
          [Symbol.iterator]() {
            return iterator;
          },
          next() {
            if (map.g !== state) {
              throw new Error(`LinkedMap got modified during iteration.`);
            }
            if (current) {
              const result = { value: [current.key, current.value], done: false };
              current = current.next;
              return result;
            } else {
              return { value: void 0, done: true };
            }
          }
        };
        return iterator;
      }
      [(_c = Symbol.toStringTag, Symbol.iterator)]() {
        return this.entries();
      }
      h(newSize) {
        if (newSize >= this.size) {
          return;
        }
        if (newSize === 0) {
          this.clear();
          return;
        }
        let current = this.d;
        let currentSize = this.size;
        while (current && currentSize > newSize) {
          this.c.delete(current.key);
          current = current.next;
          currentSize--;
        }
        this.d = current;
        this.f = currentSize;
        if (current) {
          current.previous = void 0;
        }
        this.g++;
      }
      i(newSize) {
        if (newSize >= this.size) {
          return;
        }
        if (newSize === 0) {
          this.clear();
          return;
        }
        let current = this.e;
        let currentSize = this.size;
        while (current && currentSize > newSize) {
          this.c.delete(current.key);
          current = current.previous;
          currentSize--;
        }
        this.e = current;
        this.f = currentSize;
        if (current) {
          current.next = void 0;
        }
        this.g++;
      }
      j(item) {
        if (!this.d && !this.e) {
          this.e = item;
        } else if (!this.d) {
          throw new Error("Invalid list");
        } else {
          item.next = this.d;
          this.d.previous = item;
        }
        this.d = item;
        this.g++;
      }
      k(item) {
        if (!this.d && !this.e) {
          this.d = item;
        } else if (!this.e) {
          throw new Error("Invalid list");
        } else {
          item.previous = this.e;
          this.e.next = item;
        }
        this.e = item;
        this.g++;
      }
      l(item) {
        if (item === this.d && item === this.e) {
          this.d = void 0;
          this.e = void 0;
        } else if (item === this.d) {
          if (!item.next) {
            throw new Error("Invalid list");
          }
          item.next.previous = void 0;
          this.d = item.next;
        } else if (item === this.e) {
          if (!item.previous) {
            throw new Error("Invalid list");
          }
          item.previous.next = void 0;
          this.e = item.previous;
        } else {
          const next = item.next;
          const previous = item.previous;
          if (!next || !previous) {
            throw new Error("Invalid list");
          }
          next.previous = previous;
          previous.next = next;
        }
        item.next = void 0;
        item.previous = void 0;
        this.g++;
      }
      m(item, touch2) {
        if (!this.d || !this.e) {
          throw new Error("Invalid list");
        }
        if (touch2 !== 1 && touch2 !== 2) {
          return;
        }
        if (touch2 === 1) {
          if (item === this.d) {
            return;
          }
          const next = item.next;
          const previous = item.previous;
          if (item === this.e) {
            previous.next = void 0;
            this.e = previous;
          } else {
            next.previous = previous;
            previous.next = next;
          }
          item.previous = void 0;
          item.next = this.d;
          this.d.previous = item;
          this.d = item;
          this.g++;
        } else if (touch2 === 2) {
          if (item === this.e) {
            return;
          }
          const next = item.next;
          const previous = item.previous;
          if (item === this.d) {
            next.previous = void 0;
            this.d = next;
          } else {
            next.previous = previous;
            previous.next = next;
          }
          item.next = void 0;
          item.previous = this.e;
          this.e.next = item;
          this.e = item;
          this.g++;
        }
      }
      toJSON() {
        const data = [];
        this.forEach((value, key) => {
          data.push([key, value]);
        });
        return data;
      }
      fromJSON(data) {
        this.clear();
        for (const [key, value] of data) {
          this.set(key, value);
        }
      }
    };
    Cache = class extends $Gc {
      constructor(limit, ratio = 1) {
        super();
        this.n = limit;
        this.o = Math.min(Math.max(0, ratio), 1);
      }
      get limit() {
        return this.n;
      }
      set limit(limit) {
        this.n = limit;
        this.p();
      }
      get ratio() {
        return this.o;
      }
      set ratio(ratio) {
        this.o = Math.min(Math.max(0, ratio), 1);
        this.p();
      }
      get(key, touch2 = 2) {
        return super.get(key, touch2);
      }
      peek(key) {
        return super.get(
          key,
          0
          /* Touch.None */
        );
      }
      set(key, value) {
        super.set(
          key,
          value,
          2
          /* Touch.AsNew */
        );
        return this;
      }
      p() {
        if (this.size > this.n) {
          this.q(Math.round(this.n * this.o));
        }
      }
    };
    $Hc = class extends Cache {
      constructor(limit, ratio = 1) {
        super(limit, ratio);
      }
      q(newSize) {
        this.h(newSize);
      }
      set(key, value) {
        super.set(key, value);
        this.p();
        return this;
      }
    };
    $Lc = class {
      constructor() {
        this.c = /* @__PURE__ */ new Map();
      }
      add(key, value) {
        let values = this.c.get(key);
        if (!values) {
          values = /* @__PURE__ */ new Set();
          this.c.set(key, values);
        }
        values.add(value);
      }
      delete(key, value) {
        const values = this.c.get(key);
        if (!values) {
          return;
        }
        values.delete(value);
        if (values.size === 0) {
          this.c.delete(key);
        }
      }
      forEach(key, fn) {
        const values = this.c.get(key);
        if (!values) {
          return;
        }
        values.forEach(fn);
      }
      get(key) {
        const values = this.c.get(key);
        if (!values) {
          return /* @__PURE__ */ new Set();
        }
        return values;
      }
    };
  }
});

// out-build/vs/base/common/iterator.js
var Iterable;
var init_iterator = __esm({
  "out-build/vs/base/common/iterator.js"() {
    "use strict";
    (function(Iterable2) {
      function is(thing) {
        return thing && typeof thing === "object" && typeof thing[Symbol.iterator] === "function";
      }
      Iterable2.is = is;
      const _empty2 = Object.freeze([]);
      function empty() {
        return _empty2;
      }
      Iterable2.empty = empty;
      function* single(element) {
        yield element;
      }
      Iterable2.single = single;
      function wrap(iterableOrElement) {
        if (is(iterableOrElement)) {
          return iterableOrElement;
        } else {
          return single(iterableOrElement);
        }
      }
      Iterable2.wrap = wrap;
      function from(iterable) {
        return iterable || _empty2;
      }
      Iterable2.from = from;
      function* reverse(array) {
        for (let i = array.length - 1; i >= 0; i--) {
          yield array[i];
        }
      }
      Iterable2.reverse = reverse;
      function isEmpty(iterable) {
        return !iterable || iterable[Symbol.iterator]().next().done === true;
      }
      Iterable2.isEmpty = isEmpty;
      function first(iterable) {
        return iterable[Symbol.iterator]().next().value;
      }
      Iterable2.first = first;
      function some(iterable, predicate) {
        let i = 0;
        for (const element of iterable) {
          if (predicate(element, i++)) {
            return true;
          }
        }
        return false;
      }
      Iterable2.some = some;
      function find(iterable, predicate) {
        for (const element of iterable) {
          if (predicate(element)) {
            return element;
          }
        }
        return void 0;
      }
      Iterable2.find = find;
      function* filter(iterable, predicate) {
        for (const element of iterable) {
          if (predicate(element)) {
            yield element;
          }
        }
      }
      Iterable2.filter = filter;
      function* map(iterable, fn) {
        let index = 0;
        for (const element of iterable) {
          yield fn(element, index++);
        }
      }
      Iterable2.map = map;
      function* flatMap(iterable, fn) {
        let index = 0;
        for (const element of iterable) {
          yield* fn(element, index++);
        }
      }
      Iterable2.flatMap = flatMap;
      function* concat(...iterables) {
        for (const iterable of iterables) {
          yield* iterable;
        }
      }
      Iterable2.concat = concat;
      function reduce(iterable, reducer, initialValue) {
        let value = initialValue;
        for (const element of iterable) {
          value = reducer(value, element);
        }
        return value;
      }
      Iterable2.reduce = reduce;
      function* slice(arr, from2, to = arr.length) {
        if (from2 < -arr.length) {
          from2 = 0;
        }
        if (from2 < 0) {
          from2 += arr.length;
        }
        if (to < 0) {
          to += arr.length;
        } else if (to > arr.length) {
          to = arr.length;
        }
        for (; from2 < to; from2++) {
          yield arr[from2];
        }
      }
      Iterable2.slice = slice;
      function consume(iterable, atMost = Number.POSITIVE_INFINITY) {
        const consumed = [];
        if (atMost === 0) {
          return [consumed, iterable];
        }
        const iterator = iterable[Symbol.iterator]();
        for (let i = 0; i < atMost; i++) {
          const next = iterator.next();
          if (next.done) {
            return [consumed, Iterable2.empty()];
          }
          consumed.push(next.value);
        }
        return [consumed, { [Symbol.iterator]() {
          return iterator;
        } }];
      }
      Iterable2.consume = consume;
      async function asyncToArray(iterable) {
        const result = [];
        for await (const item of iterable) {
          result.push(item);
        }
        return Promise.resolve(result);
      }
      Iterable2.asyncToArray = asyncToArray;
    })(Iterable || (Iterable = {}));
  }
});

// out-build/vs/base/common/lifecycle.js
function $Sc(tracker) {
  disposableTracker = tracker;
}
function $Tc(x) {
  disposableTracker?.trackDisposable(x);
  return x;
}
function $Uc(disposable) {
  disposableTracker?.markAsDisposed(disposable);
}
function setParentOfDisposable(child, parent) {
  disposableTracker?.setParent(child, parent);
}
function setParentOfDisposables(children, parent) {
  if (!disposableTracker) {
    return;
  }
  for (const child of children) {
    disposableTracker.setParent(child, parent);
  }
}
function $Wc(thing) {
  return typeof thing === "object" && thing !== null && typeof thing.dispose === "function" && thing.dispose.length === 0;
}
function $Xc(arg) {
  if (Iterable.is(arg)) {
    const errors = [];
    for (const d of arg) {
      if (d) {
        try {
          d.dispose();
        } catch (e) {
          errors.push(e);
        }
      }
    }
    if (errors.length === 1) {
      throw errors[0];
    } else if (errors.length > 1) {
      throw new AggregateError(errors, "Encountered errors while disposing of store");
    }
    return Array.isArray(arg) ? [] : arg;
  } else if (arg) {
    arg.dispose();
    return arg;
  }
}
function $Zc(...disposables) {
  const parent = $1c(() => $Xc(disposables));
  setParentOfDisposables(disposables, parent);
  return parent;
}
function $1c(fn) {
  const self2 = $Tc({
    dispose: $Qc(() => {
      $Uc(self2);
      fn();
    })
  });
  return self2;
}
var TRACK_DISPOSABLES, disposableTracker, $Rc, $2c, $3c, $4c, $_c;
var init_lifecycle = __esm({
  "out-build/vs/base/common/lifecycle.js"() {
    "use strict";
    init_arrays();
    init_collections();
    init_map();
    init_functional();
    init_iterator();
    TRACK_DISPOSABLES = false;
    disposableTracker = null;
    $Rc = class _$Rc {
      constructor() {
        this.b = /* @__PURE__ */ new Map();
      }
      static {
        this.a = 0;
      }
      c(d) {
        let val = this.b.get(d);
        if (!val) {
          val = { parent: null, source: null, isSingleton: false, value: d, idx: _$Rc.a++ };
          this.b.set(d, val);
        }
        return val;
      }
      trackDisposable(d) {
        const data = this.c(d);
        if (!data.source) {
          data.source = new Error().stack;
        }
      }
      setParent(child, parent) {
        const data = this.c(child);
        data.parent = parent;
      }
      markAsDisposed(x) {
        this.b.delete(x);
      }
      markAsSingleton(disposable) {
        this.c(disposable).isSingleton = true;
      }
      f(data, cache2) {
        const cacheValue = cache2.get(data);
        if (cacheValue) {
          return cacheValue;
        }
        const result = data.parent ? this.f(this.c(data.parent), cache2) : data;
        cache2.set(data, result);
        return result;
      }
      getTrackedDisposables() {
        const rootParentCache = /* @__PURE__ */ new Map();
        const leaking = [...this.b.entries()].filter(([, v]) => v.source !== null && !this.f(v, rootParentCache).isSingleton).flatMap(([k]) => k);
        return leaking;
      }
      computeLeakingDisposables(maxReported = 10, preComputedLeaks) {
        let uncoveredLeakingObjs;
        if (preComputedLeaks) {
          uncoveredLeakingObjs = preComputedLeaks;
        } else {
          const rootParentCache = /* @__PURE__ */ new Map();
          const leakingObjects = [...this.b.values()].filter((info) => info.source !== null && !this.f(info, rootParentCache).isSingleton);
          if (leakingObjects.length === 0) {
            return;
          }
          const leakingObjsSet = new Set(leakingObjects.map((o) => o.value));
          uncoveredLeakingObjs = leakingObjects.filter((l) => {
            return !(l.parent && leakingObjsSet.has(l.parent));
          });
          if (uncoveredLeakingObjs.length === 0) {
            throw new Error("There are cyclic diposable chains!");
          }
        }
        if (!uncoveredLeakingObjs) {
          return void 0;
        }
        function getStackTracePath(leaking) {
          function removePrefix(array, linesToRemove) {
            while (array.length > 0 && linesToRemove.some((regexp) => typeof regexp === "string" ? regexp === array[0] : array[0].match(regexp))) {
              array.shift();
            }
          }
          const lines = leaking.source.split("\n").map((p) => p.trim().replace("at ", "")).filter((l) => l !== "");
          removePrefix(lines, ["Error", /^trackDisposable \(.*\)$/, /^DisposableTracker.trackDisposable \(.*\)$/]);
          return lines.reverse();
        }
        const stackTraceStarts = new $Lc();
        for (const leaking of uncoveredLeakingObjs) {
          const stackTracePath = getStackTracePath(leaking);
          for (let i2 = 0; i2 <= stackTracePath.length; i2++) {
            stackTraceStarts.add(stackTracePath.slice(0, i2).join("\n"), leaking);
          }
        }
        uncoveredLeakingObjs.sort($9b((l) => l.idx, $$b));
        let message = "";
        let i = 0;
        for (const leaking of uncoveredLeakingObjs.slice(0, maxReported)) {
          i++;
          const stackTracePath = getStackTracePath(leaking);
          const stackTraceFormattedLines = [];
          for (let i2 = 0; i2 < stackTracePath.length; i2++) {
            let line = stackTracePath[i2];
            const starts = stackTraceStarts.get(stackTracePath.slice(0, i2 + 1).join("\n"));
            line = `(shared with ${starts.size}/${uncoveredLeakingObjs.length} leaks) at ${line}`;
            const prevStarts = stackTraceStarts.get(stackTracePath.slice(0, i2).join("\n"));
            const continuations = $a([...prevStarts].map((d) => getStackTracePath(d)[i2]), (v) => v);
            delete continuations[stackTracePath[i2]];
            for (const [cont, set] of Object.entries(continuations)) {
              stackTraceFormattedLines.unshift(`    - stacktraces of ${set.length} other leaks continue with ${cont}`);
            }
            stackTraceFormattedLines.unshift(line);
          }
          message += `


==================== Leaking disposable ${i}/${uncoveredLeakingObjs.length}: ${leaking.value.constructor.name} ====================
${stackTraceFormattedLines.join("\n")}
============================================================

`;
        }
        if (uncoveredLeakingObjs.length > maxReported) {
          message += `


... and ${uncoveredLeakingObjs.length - maxReported} more leaking disposables

`;
        }
        return { leaks: uncoveredLeakingObjs, details: message };
      }
    };
    if (TRACK_DISPOSABLES) {
      const __is_disposable_tracked__ = "__is_disposable_tracked__";
      $Sc(new class {
        trackDisposable(x) {
          const stack = new Error("Potentially leaked disposable").stack;
          setTimeout(() => {
            if (!x[__is_disposable_tracked__]) {
              console.log(stack);
            }
          }, 3e3);
        }
        setParent(child, parent) {
          if (child && child !== $3c.None) {
            try {
              child[__is_disposable_tracked__] = true;
            } catch {
            }
          }
        }
        markAsDisposed(disposable) {
          if (disposable && disposable !== $3c.None) {
            try {
              disposable[__is_disposable_tracked__] = true;
            } catch {
            }
          }
        }
        markAsSingleton(disposable) {
        }
      }());
    }
    $2c = class _$2c {
      static {
        this.DISABLE_DISPOSED_WARNING = false;
      }
      constructor() {
        this.f = /* @__PURE__ */ new Set();
        this.g = false;
        $Tc(this);
      }
      /**
       * Dispose of all registered disposables and mark this object as disposed.
       *
       * Any future disposables added to this object will be disposed of on `add`.
       */
      dispose() {
        if (this.g) {
          return;
        }
        $Uc(this);
        this.g = true;
        this.clear();
      }
      /**
       * @return `true` if this object has been disposed of.
       */
      get isDisposed() {
        return this.g;
      }
      /**
       * Dispose of all registered disposables but do not mark this object as disposed.
       */
      clear() {
        if (this.f.size === 0) {
          return;
        }
        try {
          $Xc(this.f);
        } finally {
          this.f.clear();
        }
      }
      /**
       * Add a new {@link IDisposable disposable} to the collection.
       */
      add(o) {
        if (!o) {
          return o;
        }
        if (o === this) {
          throw new Error("Cannot register a disposable on itself!");
        }
        setParentOfDisposable(o, this);
        if (this.g) {
          if (!_$2c.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);
          }
        } else {
          this.f.add(o);
        }
        return o;
      }
      /**
       * Deletes a disposable from store and disposes of it. This will not throw or warn and proceed to dispose the
       * disposable even when the disposable is not part in the store.
       */
      delete(o) {
        if (!o) {
          return;
        }
        if (o === this) {
          throw new Error("Cannot dispose a disposable on itself!");
        }
        this.f.delete(o);
        o.dispose();
      }
      /**
       * Deletes the value from the store, but does not dispose it.
       */
      deleteAndLeak(o) {
        if (!o) {
          return;
        }
        if (this.f.has(o)) {
          this.f.delete(o);
          setParentOfDisposable(o, null);
        }
      }
    };
    $3c = class {
      static {
        this.None = Object.freeze({ dispose() {
        } });
      }
      constructor() {
        this.q = new $2c();
        $Tc(this);
        setParentOfDisposable(this.q, this);
      }
      dispose() {
        $Uc(this);
        this.q.dispose();
      }
      /**
       * Adds `o` to the collection of disposables managed by this object.
       */
      B(o) {
        if (o === this) {
          throw new Error("Cannot register a disposable on itself!");
        }
        return this.q.add(o);
      }
    };
    $4c = class {
      constructor() {
        this.b = false;
        $Tc(this);
      }
      get value() {
        return this.b ? void 0 : this.a;
      }
      set value(value) {
        if (this.b || value === this.a) {
          return;
        }
        this.a?.dispose();
        if (value) {
          setParentOfDisposable(value, this);
        }
        this.a = value;
      }
      /**
       * Resets the stored value and disposed of the previously stored value.
       */
      clear() {
        this.value = void 0;
      }
      dispose() {
        this.b = true;
        $Uc(this);
        this.a?.dispose();
        this.a = void 0;
      }
      /**
       * Clears the value, but does not dispose it.
       * The old value is returned.
      */
      clearAndLeak() {
        const oldValue = this.a;
        this.a = void 0;
        if (oldValue) {
          setParentOfDisposable(oldValue, null);
        }
        return oldValue;
      }
    };
    $_c = class {
      constructor() {
        this.a = /* @__PURE__ */ new Map();
        this.b = false;
        $Tc(this);
      }
      /**
       * Disposes of all stored values and mark this object as disposed.
       *
       * Trying to use this object after it has been disposed of is an error.
       */
      dispose() {
        $Uc(this);
        this.b = true;
        this.clearAndDisposeAll();
      }
      /**
       * Disposes of all stored values and clear the map, but DO NOT mark this object as disposed.
       */
      clearAndDisposeAll() {
        if (!this.a.size) {
          return;
        }
        try {
          $Xc(this.a.values());
        } finally {
          this.a.clear();
        }
      }
      has(key) {
        return this.a.has(key);
      }
      get size() {
        return this.a.size;
      }
      get(key) {
        return this.a.get(key);
      }
      set(key, value, skipDisposeOnOverwrite = false) {
        if (this.b) {
          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);
        }
        if (!skipDisposeOnOverwrite) {
          this.a.get(key)?.dispose();
        }
        this.a.set(key, value);
      }
      /**
       * Delete the value stored for `key` from this map and also dispose of it.
       */
      deleteAndDispose(key) {
        this.a.get(key)?.dispose();
        this.a.delete(key);
      }
      /**
       * Delete the value stored for `key` from this map but return it. The caller is
       * responsible for disposing of the value.
       */
      deleteAndLeak(key) {
        const value = this.a.get(key);
        this.a.delete(key);
        return value;
      }
      keys() {
        return this.a.keys();
      }
      values() {
        return this.a.values();
      }
      [Symbol.iterator]() {
        return this.a[Symbol.iterator]();
      }
    };
  }
});

// out-build/vs/base/common/linkedList.js
var Node, $cd;
var init_linkedList = __esm({
  "out-build/vs/base/common/linkedList.js"() {
    "use strict";
    Node = class _Node {
      static {
        this.Undefined = new _Node(void 0);
      }
      constructor(element) {
        this.element = element;
        this.next = _Node.Undefined;
        this.prev = _Node.Undefined;
      }
    };
    $cd = class {
      constructor() {
        this.a = Node.Undefined;
        this.b = Node.Undefined;
        this.c = 0;
      }
      get size() {
        return this.c;
      }
      isEmpty() {
        return this.a === Node.Undefined;
      }
      clear() {
        let node = this.a;
        while (node !== Node.Undefined) {
          const next = node.next;
          node.prev = Node.Undefined;
          node.next = Node.Undefined;
          node = next;
        }
        this.a = Node.Undefined;
        this.b = Node.Undefined;
        this.c = 0;
      }
      unshift(element) {
        return this.d(element, false);
      }
      push(element) {
        return this.d(element, true);
      }
      d(element, atTheEnd) {
        const newNode = new Node(element);
        if (this.a === Node.Undefined) {
          this.a = newNode;
          this.b = newNode;
        } else if (atTheEnd) {
          const oldLast = this.b;
          this.b = newNode;
          newNode.prev = oldLast;
          oldLast.next = newNode;
        } else {
          const oldFirst = this.a;
          this.a = newNode;
          newNode.next = oldFirst;
          oldFirst.prev = newNode;
        }
        this.c += 1;
        let didRemove = false;
        return () => {
          if (!didRemove) {
            didRemove = true;
            this.e(newNode);
          }
        };
      }
      shift() {
        if (this.a === Node.Undefined) {
          return void 0;
        } else {
          const res = this.a.element;
          this.e(this.a);
          return res;
        }
      }
      pop() {
        if (this.b === Node.Undefined) {
          return void 0;
        } else {
          const res = this.b.element;
          this.e(this.b);
          return res;
        }
      }
      e(node) {
        if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {
          const anchor = node.prev;
          anchor.next = node.next;
          node.next.prev = anchor;
        } else if (node.prev === Node.Undefined && node.next === Node.Undefined) {
          this.a = Node.Undefined;
          this.b = Node.Undefined;
        } else if (node.next === Node.Undefined) {
          this.b = this.b.prev;
          this.b.next = Node.Undefined;
        } else if (node.prev === Node.Undefined) {
          this.a = this.a.next;
          this.a.prev = Node.Undefined;
        }
        this.c -= 1;
      }
      *[Symbol.iterator]() {
        let node = this.a;
        while (node !== Node.Undefined) {
          yield node.element;
          node = node.next;
        }
      }
    };
  }
});

// out-build/vs/base/common/stopwatch.js
var hasPerformanceNow, $te;
var init_stopwatch = __esm({
  "out-build/vs/base/common/stopwatch.js"() {
    "use strict";
    hasPerformanceNow = globalThis.performance && typeof globalThis.performance.now === "function";
    $te = class _$te {
      static create(highResolution) {
        return new _$te(highResolution);
      }
      constructor(highResolution) {
        this.c = hasPerformanceNow && highResolution === false ? Date.now : globalThis.performance.now.bind(globalThis.performance);
        this.a = this.c();
        this.b = -1;
      }
      stop() {
        this.b = this.c();
      }
      reset() {
        this.a = this.c();
        this.b = -1;
      }
      elapsed() {
        if (this.b !== -1) {
          return this.b - this.a;
        }
        return this.c() - this.a;
      }
    };
  }
});

// out-build/vs/base/common/event.js
var _enableListenerGCedWarning, _enableDisposeWithListenerWarning, _enableSnapshotPotentialLeakWarning, Event, $ve, _globalLeakWarningThreshold, LeakageMonitor, Stacktrace, $xe, $ye, id, UniqueContainer, compactionThreshold, forEachListener, _listenerFinalizers, $ze, EventDeliveryQueuePrivate, $Ce, $Fe, $Ie;
var init_event = __esm({
  "out-build/vs/base/common/event.js"() {
    "use strict";
    init_collections();
    init_errors();
    init_functional();
    init_lifecycle();
    init_linkedList();
    init_stopwatch();
    _enableListenerGCedWarning = false;
    _enableDisposeWithListenerWarning = false;
    _enableSnapshotPotentialLeakWarning = false;
    (function(Event2) {
      Event2.None = () => $3c.None;
      function _addLeakageTraceLogic(options2) {
        if (_enableSnapshotPotentialLeakWarning) {
          const { onDidAddListener: origListenerDidAdd } = options2;
          const stack = Stacktrace.create();
          let count = 0;
          options2.onDidAddListener = () => {
            if (++count === 2) {
              console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here");
              stack.print();
            }
            origListenerDidAdd?.();
          };
        }
      }
      function defer(event, disposable) {
        return debounce(event, () => void 0, 0, void 0, true, void 0, disposable);
      }
      Event2.defer = defer;
      function once(event) {
        return (listener, thisArgs = null, disposables) => {
          let didFire = false;
          let result = void 0;
          result = event((e) => {
            if (didFire) {
              return;
            } else if (result) {
              result.dispose();
            } else {
              didFire = true;
            }
            return listener.call(thisArgs, e);
          }, null, disposables);
          if (didFire) {
            result.dispose();
          }
          return result;
        };
      }
      Event2.once = once;
      function onceIf(event, condition) {
        return Event2.once(Event2.filter(event, condition));
      }
      Event2.onceIf = onceIf;
      function map(event, map2, disposable) {
        return snapshot((listener, thisArgs = null, disposables) => event((i) => listener.call(thisArgs, map2(i)), null, disposables), disposable);
      }
      Event2.map = map;
      function forEach(event, each, disposable) {
        return snapshot((listener, thisArgs = null, disposables) => event((i) => {
          each(i);
          listener.call(thisArgs, i);
        }, null, disposables), disposable);
      }
      Event2.forEach = forEach;
      function filter(event, filter2, disposable) {
        return snapshot((listener, thisArgs = null, disposables) => event((e) => filter2(e) && listener.call(thisArgs, e), null, disposables), disposable);
      }
      Event2.filter = filter;
      function signal(event) {
        return event;
      }
      Event2.signal = signal;
      function any(...events) {
        return (listener, thisArgs = null, disposables) => {
          const disposable = $Zc(...events.map((event) => event((e) => listener.call(thisArgs, e))));
          return addAndReturnDisposable(disposable, disposables);
        };
      }
      Event2.any = any;
      function reduce(event, merge, initial, disposable) {
        let output = initial;
        return map(event, (e) => {
          output = merge(output, e);
          return output;
        }, disposable);
      }
      Event2.reduce = reduce;
      function snapshot(event, disposable) {
        let listener;
        const options2 = {
          onWillAddFirstListener() {
            listener = event(emitter.fire, emitter);
          },
          onDidRemoveLastListener() {
            listener?.dispose();
          }
        };
        if (!disposable) {
          _addLeakageTraceLogic(options2);
        }
        const emitter = new $ze(options2);
        disposable?.add(emitter);
        return emitter.event;
      }
      function addAndReturnDisposable(d, store) {
        if (store instanceof Array) {
          store.push(d);
        } else if (store) {
          store.add(d);
        }
        return d;
      }
      function debounce(event, merge, delay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold, disposable) {
        let subscription;
        let output = void 0;
        let handle = void 0;
        let numDebouncedCalls = 0;
        let doFire;
        const options2 = {
          leakWarningThreshold,
          onWillAddFirstListener() {
            subscription = event((cur) => {
              numDebouncedCalls++;
              output = merge(output, cur);
              if (leading && !handle) {
                emitter.fire(output);
                output = void 0;
              }
              doFire = () => {
                const _output = output;
                output = void 0;
                handle = void 0;
                if (!leading || numDebouncedCalls > 1) {
                  emitter.fire(_output);
                }
                numDebouncedCalls = 0;
              };
              if (typeof delay === "number") {
                clearTimeout(handle);
                handle = setTimeout(doFire, delay);
              } else {
                if (handle === void 0) {
                  handle = 0;
                  queueMicrotask(doFire);
                }
              }
            });
          },
          onWillRemoveListener() {
            if (flushOnListenerRemove && numDebouncedCalls > 0) {
              doFire?.();
            }
          },
          onDidRemoveLastListener() {
            doFire = void 0;
            subscription.dispose();
          }
        };
        if (!disposable) {
          _addLeakageTraceLogic(options2);
        }
        const emitter = new $ze(options2);
        disposable?.add(emitter);
        return emitter.event;
      }
      Event2.debounce = debounce;
      function accumulate(event, delay = 0, disposable) {
        return Event2.debounce(event, (last, e) => {
          if (!last) {
            return [e];
          }
          last.push(e);
          return last;
        }, delay, void 0, true, void 0, disposable);
      }
      Event2.accumulate = accumulate;
      function latch(event, equals = (a, b) => a === b, disposable) {
        let firstCall = true;
        let cache2;
        return filter(event, (value) => {
          const shouldEmit = firstCall || !equals(value, cache2);
          firstCall = false;
          cache2 = value;
          return shouldEmit;
        }, disposable);
      }
      Event2.latch = latch;
      function split(event, isT, disposable) {
        return [
          Event2.filter(event, isT, disposable),
          Event2.filter(event, (e) => !isT(e), disposable)
        ];
      }
      Event2.split = split;
      function buffer(event, flushAfterTimeout = false, _buffer = [], disposable) {
        let buffer2 = _buffer.slice();
        let listener = event((e) => {
          if (buffer2) {
            buffer2.push(e);
          } else {
            emitter.fire(e);
          }
        });
        if (disposable) {
          disposable.add(listener);
        }
        const flush = () => {
          buffer2?.forEach((e) => emitter.fire(e));
          buffer2 = null;
        };
        const emitter = new $ze({
          onWillAddFirstListener() {
            if (!listener) {
              listener = event((e) => emitter.fire(e));
              if (disposable) {
                disposable.add(listener);
              }
            }
          },
          onDidAddFirstListener() {
            if (buffer2) {
              if (flushAfterTimeout) {
                setTimeout(flush);
              } else {
                flush();
              }
            }
          },
          onDidRemoveLastListener() {
            if (listener) {
              listener.dispose();
            }
            listener = null;
          }
        });
        if (disposable) {
          disposable.add(emitter);
        }
        return emitter.event;
      }
      Event2.buffer = buffer;
      function chain(event, sythensize) {
        const fn = (listener, thisArgs, disposables) => {
          const cs = sythensize(new ChainableSynthesis());
          return event(function(value) {
            const result = cs.evaluate(value);
            if (result !== HaltChainable) {
              listener.call(thisArgs, result);
            }
          }, void 0, disposables);
        };
        return fn;
      }
      Event2.chain = chain;
      const HaltChainable = Symbol("HaltChainable");
      class ChainableSynthesis {
        constructor() {
          this.f = [];
        }
        map(fn) {
          this.f.push(fn);
          return this;
        }
        forEach(fn) {
          this.f.push((v) => {
            fn(v);
            return v;
          });
          return this;
        }
        filter(fn) {
          this.f.push((v) => fn(v) ? v : HaltChainable);
          return this;
        }
        reduce(merge, initial) {
          let last = initial;
          this.f.push((v) => {
            last = merge(last, v);
            return last;
          });
          return this;
        }
        latch(equals = (a, b) => a === b) {
          let firstCall = true;
          let cache2;
          this.f.push((value) => {
            const shouldEmit = firstCall || !equals(value, cache2);
            firstCall = false;
            cache2 = value;
            return shouldEmit ? value : HaltChainable;
          });
          return this;
        }
        evaluate(value) {
          for (const step of this.f) {
            value = step(value);
            if (value === HaltChainable) {
              break;
            }
          }
          return value;
        }
      }
      function fromNodeEventEmitter(emitter, eventName, map2 = (id2) => id2) {
        const fn = (...args) => result.fire(map2(...args));
        const onFirstListenerAdd = () => emitter.on(eventName, fn);
        const onLastListenerRemove = () => emitter.removeListener(eventName, fn);
        const result = new $ze({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });
        return result.event;
      }
      Event2.fromNodeEventEmitter = fromNodeEventEmitter;
      function fromDOMEventEmitter(emitter, eventName, map2 = (id2) => id2) {
        const fn = (...args) => result.fire(map2(...args));
        const onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);
        const onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);
        const result = new $ze({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });
        return result.event;
      }
      Event2.fromDOMEventEmitter = fromDOMEventEmitter;
      function toPromise(event) {
        return new Promise((resolve4) => once(event)(resolve4));
      }
      Event2.toPromise = toPromise;
      function fromPromise(promise) {
        const result = new $ze();
        promise.then((res) => {
          result.fire(res);
        }, () => {
          result.fire(void 0);
        }).finally(() => {
          result.dispose();
        });
        return result.event;
      }
      Event2.fromPromise = fromPromise;
      function forward(from, to) {
        return from((e) => to.fire(e));
      }
      Event2.forward = forward;
      function runAndSubscribe(event, handler, initial) {
        handler(initial);
        return event((e) => handler(e));
      }
      Event2.runAndSubscribe = runAndSubscribe;
      class EmitterObserver {
        constructor(_observable, store) {
          this._observable = _observable;
          this.f = 0;
          this.g = false;
          const options2 = {
            onWillAddFirstListener: () => {
              _observable.addObserver(this);
              this._observable.reportChanges();
            },
            onDidRemoveLastListener: () => {
              _observable.removeObserver(this);
            }
          };
          if (!store) {
            _addLeakageTraceLogic(options2);
          }
          this.emitter = new $ze(options2);
          if (store) {
            store.add(this.emitter);
          }
        }
        beginUpdate(_observable) {
          this.f++;
        }
        handlePossibleChange(_observable) {
        }
        handleChange(_observable, _change) {
          this.g = true;
        }
        endUpdate(_observable) {
          this.f--;
          if (this.f === 0) {
            this._observable.reportChanges();
            if (this.g) {
              this.g = false;
              this.emitter.fire(this._observable.get());
            }
          }
        }
      }
      function fromObservable(obs, store) {
        const observer = new EmitterObserver(obs, store);
        return observer.emitter.event;
      }
      Event2.fromObservable = fromObservable;
      function fromObservableLight(observable) {
        return (listener, thisArgs, disposables) => {
          let count = 0;
          let didChange = false;
          const observer = {
            beginUpdate() {
              count++;
            },
            endUpdate() {
              count--;
              if (count === 0) {
                observable.reportChanges();
                if (didChange) {
                  didChange = false;
                  listener.call(thisArgs);
                }
              }
            },
            handlePossibleChange() {
            },
            handleChange() {
              didChange = true;
            }
          };
          observable.addObserver(observer);
          observable.reportChanges();
          const disposable = {
            dispose() {
              observable.removeObserver(observer);
            }
          };
          if (disposables instanceof $2c) {
            disposables.add(disposable);
          } else if (Array.isArray(disposables)) {
            disposables.push(disposable);
          }
          return disposable;
        };
      }
      Event2.fromObservableLight = fromObservableLight;
    })(Event || (Event = {}));
    $ve = class _$ve {
      static {
        this.all = /* @__PURE__ */ new Set();
      }
      static {
        this.f = 0;
      }
      constructor(name) {
        this.listenerCount = 0;
        this.invocationCount = 0;
        this.elapsedOverall = 0;
        this.durations = [];
        this.name = `${name}_${_$ve.f++}`;
        _$ve.all.add(this);
      }
      start(listenerCount) {
        this.g = new $te();
        this.listenerCount = listenerCount;
      }
      stop() {
        if (this.g) {
          const elapsed = this.g.elapsed();
          this.durations.push(elapsed);
          this.elapsedOverall += elapsed;
          this.invocationCount += 1;
          this.g = void 0;
        }
      }
    };
    _globalLeakWarningThreshold = -1;
    LeakageMonitor = class _LeakageMonitor {
      static {
        this.f = 1;
      }
      constructor(j, threshold, name = (_LeakageMonitor.f++).toString(16).padStart(3, "0")) {
        this.j = j;
        this.threshold = threshold;
        this.name = name;
        this.h = 0;
      }
      dispose() {
        this.g?.clear();
      }
      check(stack, listenerCount) {
        const threshold = this.threshold;
        if (threshold <= 0 || listenerCount < threshold) {
          return void 0;
        }
        if (!this.g) {
          this.g = /* @__PURE__ */ new Map();
        }
        const count = this.g.get(stack.value) || 0;
        this.g.set(stack.value, count + 1);
        this.h -= 1;
        if (this.h <= 0) {
          this.h = threshold * 0.5;
          const [topStack, topCount] = this.getMostFrequentStack();
          const message = `[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`;
          console.warn(message);
          console.warn(topStack);
          const error = new $xe(message, topStack);
          this.j(error);
        }
        return () => {
          const count2 = this.g.get(stack.value) || 0;
          this.g.set(stack.value, count2 - 1);
        };
      }
      getMostFrequentStack() {
        if (!this.g) {
          return void 0;
        }
        let topStack;
        let topCount = 0;
        for (const [stack, count] of this.g) {
          if (!topStack || topCount < count) {
            topStack = [stack, count];
            topCount = count;
          }
        }
        return topStack;
      }
    };
    Stacktrace = class _Stacktrace {
      static create() {
        const err = new Error();
        return new _Stacktrace(err.stack ?? "");
      }
      constructor(value) {
        this.value = value;
      }
      print() {
        console.warn(this.value.split("\n").slice(2).join("\n"));
      }
    };
    $xe = class extends Error {
      constructor(message, stack) {
        super(message);
        this.name = "ListenerLeakError";
        this.stack = stack;
      }
    };
    $ye = class extends Error {
      constructor(message, stack) {
        super(message);
        this.name = "ListenerRefusalError";
        this.stack = stack;
      }
    };
    id = 0;
    UniqueContainer = class {
      constructor(value) {
        this.value = value;
        this.id = id++;
      }
    };
    compactionThreshold = 2;
    forEachListener = (listeners, fn) => {
      if (listeners instanceof UniqueContainer) {
        fn(listeners);
      } else {
        for (let i = 0; i < listeners.length; i++) {
          const l = listeners[i];
          if (l) {
            fn(l);
          }
        }
      }
    };
    if (_enableListenerGCedWarning) {
      const leaks = [];
      setInterval(() => {
        if (leaks.length === 0) {
          return;
        }
        console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:");
        console.warn(leaks.join("\n"));
        leaks.length = 0;
      }, 3e3);
      _listenerFinalizers = new FinalizationRegistry((heldValue) => {
        if (typeof heldValue === "string") {
          leaks.push(heldValue);
        }
      });
    }
    $ze = class {
      constructor(options2) {
        this.z = 0;
        this.f = options2;
        this.g = _globalLeakWarningThreshold > 0 || this.f?.leakWarningThreshold ? new LeakageMonitor(options2?.onListenerError ?? $gb, this.f?.leakWarningThreshold ?? _globalLeakWarningThreshold) : void 0;
        this.j = this.f?._profName ? new $ve(this.f._profName) : void 0;
        this.w = this.f?.deliveryQueue;
      }
      dispose() {
        if (!this.m) {
          this.m = true;
          if (this.w?.current === this) {
            this.w.reset();
          }
          if (this.u) {
            if (_enableDisposeWithListenerWarning) {
              const listeners = this.u;
              queueMicrotask(() => {
                forEachListener(listeners, (l) => l.stack?.print());
              });
            }
            this.u = void 0;
            this.z = 0;
          }
          this.f?.onDidRemoveLastListener?.();
          this.g?.dispose();
        }
      }
      /**
       * For the public to allow to subscribe
       * to events from this Emitter
       */
      get event() {
        this.q ??= (callback, thisArgs, disposables) => {
          if (this.g && this.z > this.g.threshold ** 2) {
            const message = `[${this.g.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this.z} vs ${this.g.threshold})`;
            console.warn(message);
            const tuple = this.g.getMostFrequentStack() ?? ["UNKNOWN stack", -1];
            const error = new $ye(`${message}. HINT: Stack shows most frequent listener (${tuple[1]}-times)`, tuple[0]);
            const errorHandler = this.f?.onListenerError || $gb;
            errorHandler(error);
            return $3c.None;
          }
          if (this.m) {
            return $3c.None;
          }
          if (thisArgs) {
            callback = callback.bind(thisArgs);
          }
          const contained = new UniqueContainer(callback);
          let removeMonitor;
          let stack;
          if (this.g && this.z >= Math.ceil(this.g.threshold * 0.2)) {
            contained.stack = Stacktrace.create();
            removeMonitor = this.g.check(contained.stack, this.z + 1);
          }
          if (_enableDisposeWithListenerWarning) {
            contained.stack = stack ?? Stacktrace.create();
          }
          if (!this.u) {
            this.f?.onWillAddFirstListener?.(this);
            this.u = contained;
            this.f?.onDidAddFirstListener?.(this);
          } else if (this.u instanceof UniqueContainer) {
            this.w ??= new EventDeliveryQueuePrivate();
            this.u = [this.u, contained];
          } else {
            this.u.push(contained);
          }
          this.f?.onDidAddListener?.(this);
          this.z++;
          const result = $1c(() => {
            _listenerFinalizers?.unregister(result);
            removeMonitor?.();
            this.A(contained);
          });
          if (disposables instanceof $2c) {
            disposables.add(result);
          } else if (Array.isArray(disposables)) {
            disposables.push(result);
          }
          if (_listenerFinalizers) {
            const stack2 = new Error().stack.split("\n").slice(2, 3).join("\n").trim();
            const match = /(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(stack2);
            _listenerFinalizers.register(result, match?.[2] ?? stack2, result);
          }
          return result;
        };
        return this.q;
      }
      A(listener) {
        this.f?.onWillRemoveListener?.(this);
        if (!this.u) {
          return;
        }
        if (this.z === 1) {
          this.u = void 0;
          this.f?.onDidRemoveLastListener?.(this);
          this.z = 0;
          return;
        }
        const listeners = this.u;
        const index = listeners.indexOf(listener);
        if (index === -1) {
          console.log("disposed?", this.m);
          console.log("size?", this.z);
          console.log("arr?", JSON.stringify(this.u));
          throw new Error("Attempted to dispose unknown listener");
        }
        this.z--;
        listeners[index] = void 0;
        const adjustDeliveryQueue = this.w.current === this;
        if (this.z * compactionThreshold <= listeners.length) {
          let n = 0;
          for (let i = 0; i < listeners.length; i++) {
            if (listeners[i]) {
              listeners[n++] = listeners[i];
            } else if (adjustDeliveryQueue && n < this.w.end) {
              this.w.end--;
              if (n < this.w.i) {
                this.w.i--;
              }
            }
          }
          listeners.length = n;
        }
      }
      B(listener, value) {
        if (!listener) {
          return;
        }
        const errorHandler = this.f?.onListenerError || $gb;
        if (!errorHandler) {
          listener.value(value);
          return;
        }
        try {
          listener.value(value);
        } catch (e) {
          errorHandler(e);
        }
      }
      /** Delivers items in the queue. Assumes the queue is ready to go. */
      C(dq) {
        const listeners = dq.current.u;
        while (dq.i < dq.end) {
          this.B(listeners[dq.i++], dq.value);
        }
        dq.reset();
      }
      /**
       * To be kept private to fire an event to
       * subscribers
       */
      fire(event) {
        if (this.w?.current) {
          this.C(this.w);
          this.j?.stop();
        }
        this.j?.start(this.z);
        if (!this.u) {
        } else if (this.u instanceof UniqueContainer) {
          this.B(this.u, event);
        } else {
          const dq = this.w;
          dq.enqueue(this, event, this.u.length);
          this.C(dq);
        }
        this.j?.stop();
      }
      hasListeners() {
        return this.z > 0;
      }
    };
    EventDeliveryQueuePrivate = class {
      constructor() {
        this.i = -1;
        this.end = 0;
      }
      enqueue(emitter, value, end) {
        this.i = 0;
        this.end = end;
        this.current = emitter;
        this.value = value;
      }
      reset() {
        this.i = this.end;
        this.current = void 0;
        this.value = void 0;
      }
    };
    $Ce = class extends $ze {
      get isPaused() {
        return this.h !== 0;
      }
      constructor(options2) {
        super(options2);
        this.h = 0;
        this.s = new $cd();
        this.t = options2?.merge;
      }
      pause() {
        this.h++;
      }
      resume() {
        if (this.h !== 0 && --this.h === 0) {
          if (this.t) {
            if (this.s.size > 0) {
              const events = Array.from(this.s);
              this.s.clear();
              super.fire(this.t(events));
            }
          } else {
            while (!this.h && this.s.size !== 0) {
              super.fire(this.s.shift());
            }
          }
        }
      }
      fire(event) {
        if (this.z) {
          if (this.h !== 0) {
            this.s.push(event);
          } else {
            super.fire(event);
          }
        }
      }
    };
    $Fe = class {
      constructor() {
        this.g = false;
        this.h = [];
        this.f = new $ze({
          onWillAddFirstListener: () => this.j(),
          onDidRemoveLastListener: () => this.k()
        });
      }
      get event() {
        return this.f.event;
      }
      add(event) {
        const e = { event, listener: null };
        this.h.push(e);
        if (this.g) {
          this.m(e);
        }
        const dispose2 = () => {
          if (this.g) {
            this.o(e);
          }
          const idx = this.h.indexOf(e);
          this.h.splice(idx, 1);
        };
        return $1c($Qc(dispose2));
      }
      j() {
        this.g = true;
        this.h.forEach((e) => this.m(e));
      }
      k() {
        this.g = false;
        this.h.forEach((e) => this.o(e));
      }
      m(e) {
        e.listener = e.event((r) => this.f.fire(r));
      }
      o(e) {
        e.listener?.dispose();
        e.listener = null;
      }
      dispose() {
        this.f.dispose();
        for (const e of this.h) {
          e.listener?.dispose();
        }
        this.h = [];
      }
    };
    $Ie = class {
      constructor() {
        this.f = false;
        this.g = Event.None;
        this.h = $3c.None;
        this.j = new $ze({
          onDidAddFirstListener: () => {
            this.f = true;
            this.h = this.g(this.j.fire, this.j);
          },
          onDidRemoveLastListener: () => {
            this.f = false;
            this.h.dispose();
          }
        });
        this.event = this.j.event;
      }
      set input(event) {
        this.g = event;
        if (this.f) {
          this.h.dispose();
          this.h = event(this.j.fire, this.j);
        }
      }
      dispose() {
        this.h.dispose();
        this.j.dispose();
      }
    };
  }
});

// out-build/vs/base/common/cancellation.js
var shortcutEvent, CancellationToken, MutableToken, $ad;
var init_cancellation = __esm({
  "out-build/vs/base/common/cancellation.js"() {
    "use strict";
    init_event();
    shortcutEvent = Object.freeze(function(callback, context) {
      const handle = setTimeout(callback.bind(context), 0);
      return { dispose() {
        clearTimeout(handle);
      } };
    });
    (function(CancellationToken2) {
      function isCancellationToken(thing) {
        if (thing === CancellationToken2.None || thing === CancellationToken2.Cancelled) {
          return true;
        }
        if (thing instanceof MutableToken) {
          return true;
        }
        if (!thing || typeof thing !== "object") {
          return false;
        }
        return typeof thing.isCancellationRequested === "boolean" && typeof thing.onCancellationRequested === "function";
      }
      CancellationToken2.isCancellationToken = isCancellationToken;
      CancellationToken2.None = Object.freeze({
        isCancellationRequested: false,
        onCancellationRequested: Event.None
      });
      CancellationToken2.Cancelled = Object.freeze({
        isCancellationRequested: true,
        onCancellationRequested: shortcutEvent
      });
    })(CancellationToken || (CancellationToken = {}));
    MutableToken = class {
      constructor() {
        this.a = false;
        this.b = null;
      }
      cancel() {
        if (!this.a) {
          this.a = true;
          if (this.b) {
            this.b.fire(void 0);
            this.dispose();
          }
        }
      }
      get isCancellationRequested() {
        return this.a;
      }
      get onCancellationRequested() {
        if (this.a) {
          return shortcutEvent;
        }
        if (!this.b) {
          this.b = new $ze();
        }
        return this.b.event;
      }
      dispose() {
        if (this.b) {
          this.b.dispose();
          this.b = null;
        }
      }
    };
    $ad = class {
      constructor(parent) {
        this.f = void 0;
        this.g = void 0;
        this.g = parent && parent.onCancellationRequested(this.cancel, this);
      }
      get token() {
        if (!this.f) {
          this.f = new MutableToken();
        }
        return this.f;
      }
      cancel() {
        if (!this.f) {
          this.f = CancellationToken.Cancelled;
        } else if (this.f instanceof MutableToken) {
          this.f.cancel();
        }
      }
      dispose(cancel = false) {
        if (cancel) {
          this.cancel();
        }
        this.g?.dispose();
        if (!this.f) {
          this.f = CancellationToken.None;
        } else if (this.f instanceof MutableToken) {
          this.f.dispose();
        }
      }
    };
  }
});

// out-build/vs/base/common/cache.js
function $pf(t) {
  return t;
}
var $qf;
var init_cache = __esm({
  "out-build/vs/base/common/cache.js"() {
    "use strict";
    init_cancellation();
    $qf = class {
      constructor(arg1, arg2) {
        this.a = void 0;
        this.b = void 0;
        if (typeof arg1 === "function") {
          this.c = arg1;
          this.d = $pf;
        } else {
          this.c = arg2;
          this.d = arg1.getCacheKey;
        }
      }
      get(arg) {
        const key = this.d(arg);
        if (this.b !== key) {
          this.b = key;
          this.a = this.c(arg);
        }
        return this.a;
      }
    };
  }
});

// out-build/vs/base/common/lazy.js
var $sf;
var init_lazy = __esm({
  "out-build/vs/base/common/lazy.js"() {
    "use strict";
    $sf = class {
      constructor(d) {
        this.d = d;
        this.a = false;
      }
      /**
       * True if the lazy value has been resolved.
       */
      get hasValue() {
        return this.a;
      }
      /**
       * Get the wrapped value.
       *
       * This will force evaluation of the lazy value if it has not been resolved yet. Lazy values are only
       * resolved once. `getValue` will re-throw exceptions that are hit while resolving the value
       */
      get value() {
        if (!this.a) {
          try {
            this.b = this.d();
          } catch (err) {
            this.c = err;
          } finally {
            this.a = true;
          }
        }
        if (this.c) {
          throw this.c;
        }
        return this.b;
      }
      /**
       * Get the wrapped value without forcing evaluation.
       */
      get rawValue() {
        return this.b;
      }
    };
  }
});

// out-build/vs/base/common/strings.js
function $vf(str) {
  if (!str || typeof str !== "string") {
    return true;
  }
  return str.trim().length === 0;
}
function $xf(template, values) {
  if (Object.keys(values).length === 0) {
    return template;
  }
  return template.replace(_format2Regexp, (match, group) => values[group] ?? match);
}
function $Af(value) {
  return value.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g, "\\$&");
}
function $Ff(haystack, needle) {
  if (!haystack || !needle) {
    return haystack;
  }
  const needleLen = needle.length;
  if (needleLen === 0 || haystack.length === 0) {
    return haystack;
  }
  let offset = 0;
  while (haystack.indexOf(needle, offset) === offset) {
    offset = offset + needleLen;
  }
  return haystack.substring(offset);
}
function $Gf(haystack, needle) {
  if (!haystack || !needle) {
    return haystack;
  }
  const needleLen = needle.length, haystackLen = haystack.length;
  if (needleLen === 0 || haystackLen === 0) {
    return haystack;
  }
  let offset = haystackLen, idx = -1;
  while (true) {
    idx = haystack.lastIndexOf(needle, offset - 1);
    if (idx === -1 || idx + needleLen !== offset) {
      break;
    }
    if (idx === 0) {
      return "";
    }
    offset = idx;
  }
  return haystack.substring(0, offset);
}
function $Jf(searchString, isRegex, options2 = {}) {
  if (!searchString) {
    throw new Error("Cannot create regex from empty string");
  }
  if (!isRegex) {
    searchString = $Af(searchString);
  }
  if (options2.wholeWord) {
    if (!/\B/.test(searchString.charAt(0))) {
      searchString = "\\b" + searchString;
    }
    if (!/\B/.test(searchString.charAt(searchString.length - 1))) {
      searchString = searchString + "\\b";
    }
  }
  let modifiers = "";
  if (options2.global) {
    modifiers += "g";
  }
  if (!options2.matchCase) {
    modifiers += "i";
  }
  if (options2.multiline) {
    modifiers += "m";
  }
  if (options2.unicode) {
    modifiers += "u";
  }
  return new RegExp(searchString, modifiers);
}
function $Sf(str, search, replacer2) {
  const parts = [];
  let last = 0;
  for (const match of str.matchAll(search)) {
    parts.push(str.slice(last, match.index));
    if (match.index === void 0) {
      throw new Error("match.index should be defined");
    }
    last = match.index + match[0].length;
    parts.push(replacer2(match[0], ...match.slice(1), match.index, str, match.groups));
  }
  parts.push(str.slice(last));
  return Promise.all(parts).then((p) => p.join(""));
}
function $Tf(a, b) {
  if (a < b) {
    return -1;
  } else if (a > b) {
    return 1;
  } else {
    return 0;
  }
}
function $Uf(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {
  for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {
    const codeA = a.charCodeAt(aStart);
    const codeB = b.charCodeAt(bStart);
    if (codeA < codeB) {
      return -1;
    } else if (codeA > codeB) {
      return 1;
    }
  }
  const aLen = aEnd - aStart;
  const bLen = bEnd - bStart;
  if (aLen < bLen) {
    return -1;
  } else if (aLen > bLen) {
    return 1;
  }
  return 0;
}
function $Vf(a, b) {
  return $Wf(a, b, 0, a.length, 0, b.length);
}
function $Wf(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {
  for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {
    let codeA = a.charCodeAt(aStart);
    let codeB = b.charCodeAt(bStart);
    if (codeA === codeB) {
      continue;
    }
    if (codeA >= 128 || codeB >= 128) {
      return $Uf(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);
    }
    if ($Yf(codeA)) {
      codeA -= 32;
    }
    if ($Yf(codeB)) {
      codeB -= 32;
    }
    const diff2 = codeA - codeB;
    if (diff2 === 0) {
      continue;
    }
    return diff2;
  }
  const aLen = aEnd - aStart;
  const bLen = bEnd - bStart;
  if (aLen < bLen) {
    return -1;
  } else if (aLen > bLen) {
    return 1;
  }
  return 0;
}
function $Yf(code) {
  return code >= 97 && code <= 122;
}
function $Zf(code) {
  return code >= 65 && code <= 90;
}
function $1f(a, b) {
  return a.length === b.length && $Wf(a, b) === 0;
}
function $2f(str, candidate) {
  const candidateLength = candidate.length;
  if (candidate.length > str.length) {
    return false;
  }
  return $Wf(str, candidate, 0, candidateLength) === 0;
}
function $5f(charCode) {
  return 55296 <= charCode && charCode <= 56319;
}
function $6f(charCode) {
  return 56320 <= charCode && charCode <= 57343;
}
function $7f(highSurrogate, lowSurrogate) {
  return (highSurrogate - 55296 << 10) + (lowSurrogate - 56320) + 65536;
}
function getGraphemeBreakRawData() {
  return JSON.parse("[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]");
}
var _format2Regexp, $mg, GraphemeBreakType, GraphemeBreakTree, CodePoint, $xg, $yg;
var init_strings = __esm({
  "out-build/vs/base/common/strings.js"() {
    "use strict";
    init_cache();
    init_lazy();
    _format2Regexp = /{([^}]+)}/g;
    $mg = String.fromCharCode(
      65279
      /* CharCode.UTF8_BOM */
    );
    (function(GraphemeBreakType2) {
      GraphemeBreakType2[GraphemeBreakType2["Other"] = 0] = "Other";
      GraphemeBreakType2[GraphemeBreakType2["Prepend"] = 1] = "Prepend";
      GraphemeBreakType2[GraphemeBreakType2["CR"] = 2] = "CR";
      GraphemeBreakType2[GraphemeBreakType2["LF"] = 3] = "LF";
      GraphemeBreakType2[GraphemeBreakType2["Control"] = 4] = "Control";
      GraphemeBreakType2[GraphemeBreakType2["Extend"] = 5] = "Extend";
      GraphemeBreakType2[GraphemeBreakType2["Regional_Indicator"] = 6] = "Regional_Indicator";
      GraphemeBreakType2[GraphemeBreakType2["SpacingMark"] = 7] = "SpacingMark";
      GraphemeBreakType2[GraphemeBreakType2["L"] = 8] = "L";
      GraphemeBreakType2[GraphemeBreakType2["V"] = 9] = "V";
      GraphemeBreakType2[GraphemeBreakType2["T"] = 10] = "T";
      GraphemeBreakType2[GraphemeBreakType2["LV"] = 11] = "LV";
      GraphemeBreakType2[GraphemeBreakType2["LVT"] = 12] = "LVT";
      GraphemeBreakType2[GraphemeBreakType2["ZWJ"] = 13] = "ZWJ";
      GraphemeBreakType2[GraphemeBreakType2["Extended_Pictographic"] = 14] = "Extended_Pictographic";
    })(GraphemeBreakType || (GraphemeBreakType = {}));
    GraphemeBreakTree = class _GraphemeBreakTree {
      static {
        this.c = null;
      }
      static getInstance() {
        if (!_GraphemeBreakTree.c) {
          _GraphemeBreakTree.c = new _GraphemeBreakTree();
        }
        return _GraphemeBreakTree.c;
      }
      constructor() {
        this.d = getGraphemeBreakRawData();
      }
      getGraphemeBreakType(codePoint) {
        if (codePoint < 32) {
          if (codePoint === 10) {
            return 3;
          }
          if (codePoint === 13) {
            return 2;
          }
          return 4;
        }
        if (codePoint < 127) {
          return 0;
        }
        const data = this.d;
        const nodeCount = data.length / 3;
        let nodeIndex = 1;
        while (nodeIndex <= nodeCount) {
          if (codePoint < data[3 * nodeIndex]) {
            nodeIndex = 2 * nodeIndex;
          } else if (codePoint > data[3 * nodeIndex + 1]) {
            nodeIndex = 2 * nodeIndex + 1;
          } else {
            return data[3 * nodeIndex + 2];
          }
        }
        return 0;
      }
    };
    (function(CodePoint2) {
      CodePoint2[CodePoint2["zwj"] = 8205] = "zwj";
      CodePoint2[CodePoint2["emojiVariantSelector"] = 65039] = "emojiVariantSelector";
      CodePoint2[CodePoint2["enclosingKeyCap"] = 8419] = "enclosingKeyCap";
    })(CodePoint || (CodePoint = {}));
    $xg = class _$xg {
      static {
        this.c = new $sf(() => {
          return 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,8218,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,8242,96,1370,96,1523,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,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,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,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,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,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,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,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,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,71922,67,71913,67,65315,67,8557,67,8450,67,8493,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,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,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,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,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,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,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,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,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,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,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,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,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,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,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,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,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,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,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,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,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,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,71919,87,71910,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,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,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,66293,90,71909,90,65338,90,8484,90,8488,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,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65297,49,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,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"cs":[65374,126,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,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"de":[65374,126,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,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"es":[8211,45,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,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"fr":[65374,126,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"it":[160,32,8211,45,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"ja":[8211,45,65306,58,65281,33,8216,96,8217,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,65283,35,65292,44,65307,59],"ko":[8211,45,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,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"pl":[65374,126,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"pt-BR":[65374,126,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,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,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"ru":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"tr":[160,32,8211,45,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,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,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"zh-hans":[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,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41],"zh-hant":[8211,45,65374,126,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,65283,35,65307,59]}');
        });
      }
      static {
        this.d = new $qf({ getCacheKey: JSON.stringify }, (locales) => {
          function arrayToMap(arr) {
            const result = /* @__PURE__ */ new Map();
            for (let i = 0; i < arr.length; i += 2) {
              result.set(arr[i], arr[i + 1]);
            }
            return result;
          }
          function mergeMaps(map1, map2) {
            const result = new Map(map1);
            for (const [key, value] of map2) {
              result.set(key, value);
            }
            return result;
          }
          function intersectMaps(map1, map2) {
            if (!map1) {
              return map2;
            }
            const result = /* @__PURE__ */ new Map();
            for (const [key, value] of map1) {
              if (map2.has(key)) {
                result.set(key, value);
              }
            }
            return result;
          }
          const data = this.c.value;
          let filteredLocales = locales.filter((l) => !l.startsWith("_") && l in data);
          if (filteredLocales.length === 0) {
            filteredLocales = ["_default"];
          }
          let languageSpecificMap = void 0;
          for (const locale of filteredLocales) {
            const map2 = arrayToMap(data[locale]);
            languageSpecificMap = intersectMaps(languageSpecificMap, map2);
          }
          const commonMap = arrayToMap(data["_common"]);
          const map = mergeMaps(commonMap, languageSpecificMap);
          return new _$xg(map);
        });
      }
      static getInstance(locales) {
        return _$xg.d.get(Array.from(locales));
      }
      static {
        this.e = new $sf(() => Object.keys(_$xg.c.value).filter((k) => !k.startsWith("_")));
      }
      static getLocales() {
        return _$xg.e.value;
      }
      constructor(f) {
        this.f = f;
      }
      isAmbiguous(codePoint) {
        return this.f.has(codePoint);
      }
      containsAmbiguousCharacter(str) {
        for (let i = 0; i < str.length; i++) {
          const codePoint = str.codePointAt(i);
          if (typeof codePoint === "number" && this.isAmbiguous(codePoint)) {
            return true;
          }
        }
        return false;
      }
      /**
       * Returns the non basic ASCII code point that the given code point can be confused,
       * or undefined if such code point does note exist.
       */
      getPrimaryConfusable(codePoint) {
        return this.f.get(codePoint);
      }
      getConfusableCodePoints() {
        return new Set(this.f.keys());
      }
    };
    $yg = class _$yg {
      static c() {
        return JSON.parse("[9,10,11,12,13,32,127,160,173,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,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,12288,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]");
      }
      static {
        this.d = void 0;
      }
      static e() {
        if (!this.d) {
          this.d = new Set(_$yg.c());
        }
        return this.d;
      }
      static isInvisibleCharacter(codePoint) {
        return _$yg.e().has(codePoint);
      }
      static containsInvisibleCharacter(str) {
        for (let i = 0; i < str.length; i++) {
          const codePoint = str.codePointAt(i);
          if (typeof codePoint === "number" && _$yg.isInvisibleCharacter(codePoint)) {
            return true;
          }
        }
        return false;
      }
      static get codePoints() {
        return _$yg.e();
      }
    };
  }
});

// out-build/vs/base/common/process.js
var safeProcess, vscodeGlobal, cwd, env, $hc, $ic;
var init_process = __esm({
  "out-build/vs/base/common/process.js"() {
    "use strict";
    init_platform();
    vscodeGlobal = globalThis.vscode;
    if (typeof vscodeGlobal !== "undefined" && typeof vscodeGlobal.process !== "undefined") {
      const sandboxProcess = vscodeGlobal.process;
      safeProcess = {
        get platform() {
          return sandboxProcess.platform;
        },
        get arch() {
          return sandboxProcess.arch;
        },
        get env() {
          return sandboxProcess.env;
        },
        cwd() {
          return sandboxProcess.cwd();
        }
      };
    } else if (typeof process !== "undefined" && typeof process?.versions?.node === "string") {
      safeProcess = {
        get platform() {
          return process.platform;
        },
        get arch() {
          return process.arch;
        },
        get env() {
          return process.env;
        },
        cwd() {
          return process.env["VSCODE_CWD"] || process.cwd();
        }
      };
    } else {
      safeProcess = {
        // Supported
        get platform() {
          return $l ? "win32" : $m ? "darwin" : "linux";
        },
        get arch() {
          return void 0;
        },
        // Unsupported
        get env() {
          return {};
        },
        cwd() {
          return "/";
        }
      };
    }
    cwd = safeProcess.cwd;
    env = safeProcess.env;
    $hc = safeProcess.platform;
    $ic = safeProcess.arch;
  }
});

// out-build/vs/base/common/path.js
function validateObject(pathObject, name) {
  if (pathObject === null || typeof pathObject !== "object") {
    throw new ErrorInvalidArgType(name, "Object", pathObject);
  }
}
function validateString(value, name) {
  if (typeof value !== "string") {
    throw new ErrorInvalidArgType(name, "string", value);
  }
}
function isPathSeparator(code) {
  return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
}
function isPosixPathSeparator(code) {
  return code === CHAR_FORWARD_SLASH;
}
function isWindowsDeviceRoot(code) {
  return code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z || code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z;
}
function normalizeString(path7, allowAboveRoot, separator, isPathSeparator2) {
  let res = "";
  let lastSegmentLength = 0;
  let lastSlash = -1;
  let dots = 0;
  let code = 0;
  for (let i = 0; i <= path7.length; ++i) {
    if (i < path7.length) {
      code = path7.charCodeAt(i);
    } else if (isPathSeparator2(code)) {
      break;
    } else {
      code = CHAR_FORWARD_SLASH;
    }
    if (isPathSeparator2(code)) {
      if (lastSlash === i - 1 || dots === 1) {
      } else if (dots === 2) {
        if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== CHAR_DOT || res.charCodeAt(res.length - 2) !== CHAR_DOT) {
          if (res.length > 2) {
            const lastSlashIndex = res.lastIndexOf(separator);
            if (lastSlashIndex === -1) {
              res = "";
              lastSegmentLength = 0;
            } else {
              res = res.slice(0, lastSlashIndex);
              lastSegmentLength = res.length - 1 - res.lastIndexOf(separator);
            }
            lastSlash = i;
            dots = 0;
            continue;
          } else if (res.length !== 0) {
            res = "";
            lastSegmentLength = 0;
            lastSlash = i;
            dots = 0;
            continue;
          }
        }
        if (allowAboveRoot) {
          res += res.length > 0 ? `${separator}..` : "..";
          lastSegmentLength = 2;
        }
      } else {
        if (res.length > 0) {
          res += `${separator}${path7.slice(lastSlash + 1, i)}`;
        } else {
          res = path7.slice(lastSlash + 1, i);
        }
        lastSegmentLength = i - lastSlash - 1;
      }
      lastSlash = i;
      dots = 0;
    } else if (code === CHAR_DOT && dots !== -1) {
      ++dots;
    } else {
      dots = -1;
    }
  }
  return res;
}
function formatExt(ext) {
  return ext ? `${ext[0] === "." ? "" : "."}${ext}` : "";
}
function _format2(sep2, pathObject) {
  validateObject(pathObject, "pathObject");
  const dir = pathObject.dir || pathObject.root;
  const base = pathObject.base || `${pathObject.name || ""}${formatExt(pathObject.ext)}`;
  if (!dir) {
    return base;
  }
  return dir === pathObject.root ? `${dir}${base}` : `${dir}${sep2}${base}`;
}
var CHAR_UPPERCASE_A, CHAR_LOWERCASE_A, CHAR_UPPERCASE_Z, CHAR_LOWERCASE_Z, CHAR_DOT, CHAR_FORWARD_SLASH, CHAR_BACKWARD_SLASH, CHAR_COLON, CHAR_QUESTION_MARK, ErrorInvalidArgType, platformIsWin32, $jc, posixCwd, $kc, $lc, $mc, $nc, $oc, $pc, $qc, $rc, $sc, $tc, $uc, $vc, sep, $xc;
var init_path = __esm({
  "out-build/vs/base/common/path.js"() {
    "use strict";
    init_process();
    CHAR_UPPERCASE_A = 65;
    CHAR_LOWERCASE_A = 97;
    CHAR_UPPERCASE_Z = 90;
    CHAR_LOWERCASE_Z = 122;
    CHAR_DOT = 46;
    CHAR_FORWARD_SLASH = 47;
    CHAR_BACKWARD_SLASH = 92;
    CHAR_COLON = 58;
    CHAR_QUESTION_MARK = 63;
    ErrorInvalidArgType = class extends Error {
      constructor(name, expected, actual) {
        let determiner;
        if (typeof expected === "string" && expected.indexOf("not ") === 0) {
          determiner = "must not be";
          expected = expected.replace(/^not /, "");
        } else {
          determiner = "must be";
        }
        const type2 = name.indexOf(".") !== -1 ? "property" : "argument";
        let msg = `The "${name}" ${type2} ${determiner} of type ${expected}`;
        msg += `. Received type ${typeof actual}`;
        super(msg);
        this.code = "ERR_INVALID_ARG_TYPE";
      }
    };
    platformIsWin32 = $hc === "win32";
    $jc = {
      // path.resolve([from ...], to)
      resolve(...pathSegments) {
        let resolvedDevice = "";
        let resolvedTail = "";
        let resolvedAbsolute = false;
        for (let i = pathSegments.length - 1; i >= -1; i--) {
          let path7;
          if (i >= 0) {
            path7 = pathSegments[i];
            validateString(path7, `paths[${i}]`);
            if (path7.length === 0) {
              continue;
            }
          } else if (resolvedDevice.length === 0) {
            path7 = cwd();
          } else {
            path7 = env[`=${resolvedDevice}`] || cwd();
            if (path7 === void 0 || path7.slice(0, 2).toLowerCase() !== resolvedDevice.toLowerCase() && path7.charCodeAt(2) === CHAR_BACKWARD_SLASH) {
              path7 = `${resolvedDevice}\\`;
            }
          }
          const len = path7.length;
          let rootEnd = 0;
          let device = "";
          let isAbsolute2 = false;
          const code = path7.charCodeAt(0);
          if (len === 1) {
            if (isPathSeparator(code)) {
              rootEnd = 1;
              isAbsolute2 = true;
            }
          } else if (isPathSeparator(code)) {
            isAbsolute2 = true;
            if (isPathSeparator(path7.charCodeAt(1))) {
              let j = 2;
              let last = j;
              while (j < len && !isPathSeparator(path7.charCodeAt(j))) {
                j++;
              }
              if (j < len && j !== last) {
                const firstPart = path7.slice(last, j);
                last = j;
                while (j < len && isPathSeparator(path7.charCodeAt(j))) {
                  j++;
                }
                if (j < len && j !== last) {
                  last = j;
                  while (j < len && !isPathSeparator(path7.charCodeAt(j))) {
                    j++;
                  }
                  if (j === len || j !== last) {
                    device = `\\\\${firstPart}\\${path7.slice(last, j)}`;
                    rootEnd = j;
                  }
                }
              }
            } else {
              rootEnd = 1;
            }
          } else if (isWindowsDeviceRoot(code) && path7.charCodeAt(1) === CHAR_COLON) {
            device = path7.slice(0, 2);
            rootEnd = 2;
            if (len > 2 && isPathSeparator(path7.charCodeAt(2))) {
              isAbsolute2 = true;
              rootEnd = 3;
            }
          }
          if (device.length > 0) {
            if (resolvedDevice.length > 0) {
              if (device.toLowerCase() !== resolvedDevice.toLowerCase()) {
                continue;
              }
            } else {
              resolvedDevice = device;
            }
          }
          if (resolvedAbsolute) {
            if (resolvedDevice.length > 0) {
              break;
            }
          } else {
            resolvedTail = `${path7.slice(rootEnd)}\\${resolvedTail}`;
            resolvedAbsolute = isAbsolute2;
            if (isAbsolute2 && resolvedDevice.length > 0) {
              break;
            }
          }
        }
        resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, "\\", isPathSeparator);
        return resolvedAbsolute ? `${resolvedDevice}\\${resolvedTail}` : `${resolvedDevice}${resolvedTail}` || ".";
      },
      normalize(path7) {
        validateString(path7, "path");
        const len = path7.length;
        if (len === 0) {
          return ".";
        }
        let rootEnd = 0;
        let device;
        let isAbsolute2 = false;
        const code = path7.charCodeAt(0);
        if (len === 1) {
          return isPosixPathSeparator(code) ? "\\" : path7;
        }
        if (isPathSeparator(code)) {
          isAbsolute2 = true;
          if (isPathSeparator(path7.charCodeAt(1))) {
            let j = 2;
            let last = j;
            while (j < len && !isPathSeparator(path7.charCodeAt(j))) {
              j++;
            }
            if (j < len && j !== last) {
              const firstPart = path7.slice(last, j);
              last = j;
              while (j < len && isPathSeparator(path7.charCodeAt(j))) {
                j++;
              }
              if (j < len && j !== last) {
                last = j;
                while (j < len && !isPathSeparator(path7.charCodeAt(j))) {
                  j++;
                }
                if (j === len) {
                  return `\\\\${firstPart}\\${path7.slice(last)}\\`;
                }
                if (j !== last) {
                  device = `\\\\${firstPart}\\${path7.slice(last, j)}`;
                  rootEnd = j;
                }
              }
            }
          } else {
            rootEnd = 1;
          }
        } else if (isWindowsDeviceRoot(code) && path7.charCodeAt(1) === CHAR_COLON) {
          device = path7.slice(0, 2);
          rootEnd = 2;
          if (len > 2 && isPathSeparator(path7.charCodeAt(2))) {
            isAbsolute2 = true;
            rootEnd = 3;
          }
        }
        let tail = rootEnd < len ? normalizeString(path7.slice(rootEnd), !isAbsolute2, "\\", isPathSeparator) : "";
        if (tail.length === 0 && !isAbsolute2) {
          tail = ".";
        }
        if (tail.length > 0 && isPathSeparator(path7.charCodeAt(len - 1))) {
          tail += "\\";
        }
        if (device === void 0) {
          return isAbsolute2 ? `\\${tail}` : tail;
        }
        return isAbsolute2 ? `${device}\\${tail}` : `${device}${tail}`;
      },
      isAbsolute(path7) {
        validateString(path7, "path");
        const len = path7.length;
        if (len === 0) {
          return false;
        }
        const code = path7.charCodeAt(0);
        return isPathSeparator(code) || // Possible device root
        len > 2 && isWindowsDeviceRoot(code) && path7.charCodeAt(1) === CHAR_COLON && isPathSeparator(path7.charCodeAt(2));
      },
      join(...paths) {
        if (paths.length === 0) {
          return ".";
        }
        let joined;
        let firstPart;
        for (let i = 0; i < paths.length; ++i) {
          const arg = paths[i];
          validateString(arg, "path");
          if (arg.length > 0) {
            if (joined === void 0) {
              joined = firstPart = arg;
            } else {
              joined += `\\${arg}`;
            }
          }
        }
        if (joined === void 0) {
          return ".";
        }
        let needsReplace = true;
        let slashCount = 0;
        if (typeof firstPart === "string" && isPathSeparator(firstPart.charCodeAt(0))) {
          ++slashCount;
          const firstLen = firstPart.length;
          if (firstLen > 1 && isPathSeparator(firstPart.charCodeAt(1))) {
            ++slashCount;
            if (firstLen > 2) {
              if (isPathSeparator(firstPart.charCodeAt(2))) {
                ++slashCount;
              } else {
                needsReplace = false;
              }
            }
          }
        }
        if (needsReplace) {
          while (slashCount < joined.length && isPathSeparator(joined.charCodeAt(slashCount))) {
            slashCount++;
          }
          if (slashCount >= 2) {
            joined = `\\${joined.slice(slashCount)}`;
          }
        }
        return $jc.normalize(joined);
      },
      // It will solve the relative path from `from` to `to`, for instance:
      //  from = 'C:\\orandea\\test\\aaa'
      //  to = 'C:\\orandea\\impl\\bbb'
      // The output of the function should be: '..\\..\\impl\\bbb'
      relative(from, to) {
        validateString(from, "from");
        validateString(to, "to");
        if (from === to) {
          return "";
        }
        const fromOrig = $jc.resolve(from);
        const toOrig = $jc.resolve(to);
        if (fromOrig === toOrig) {
          return "";
        }
        from = fromOrig.toLowerCase();
        to = toOrig.toLowerCase();
        if (from === to) {
          return "";
        }
        let fromStart = 0;
        while (fromStart < from.length && from.charCodeAt(fromStart) === CHAR_BACKWARD_SLASH) {
          fromStart++;
        }
        let fromEnd = from.length;
        while (fromEnd - 1 > fromStart && from.charCodeAt(fromEnd - 1) === CHAR_BACKWARD_SLASH) {
          fromEnd--;
        }
        const fromLen = fromEnd - fromStart;
        let toStart = 0;
        while (toStart < to.length && to.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {
          toStart++;
        }
        let toEnd = to.length;
        while (toEnd - 1 > toStart && to.charCodeAt(toEnd - 1) === CHAR_BACKWARD_SLASH) {
          toEnd--;
        }
        const toLen = toEnd - toStart;
        const length = fromLen < toLen ? fromLen : toLen;
        let lastCommonSep = -1;
        let i = 0;
        for (; i < length; i++) {
          const fromCode = from.charCodeAt(fromStart + i);
          if (fromCode !== to.charCodeAt(toStart + i)) {
            break;
          } else if (fromCode === CHAR_BACKWARD_SLASH) {
            lastCommonSep = i;
          }
        }
        if (i !== length) {
          if (lastCommonSep === -1) {
            return toOrig;
          }
        } else {
          if (toLen > length) {
            if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {
              return toOrig.slice(toStart + i + 1);
            }
            if (i === 2) {
              return toOrig.slice(toStart + i);
            }
          }
          if (fromLen > length) {
            if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {
              lastCommonSep = i;
            } else if (i === 2) {
              lastCommonSep = 3;
            }
          }
          if (lastCommonSep === -1) {
            lastCommonSep = 0;
          }
        }
        let out = "";
        for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
          if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {
            out += out.length === 0 ? ".." : "\\..";
          }
        }
        toStart += lastCommonSep;
        if (out.length > 0) {
          return `${out}${toOrig.slice(toStart, toEnd)}`;
        }
        if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {
          ++toStart;
        }
        return toOrig.slice(toStart, toEnd);
      },
      toNamespacedPath(path7) {
        if (typeof path7 !== "string" || path7.length === 0) {
          return path7;
        }
        const resolvedPath = $jc.resolve(path7);
        if (resolvedPath.length <= 2) {
          return path7;
        }
        if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {
          if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {
            const code = resolvedPath.charCodeAt(2);
            if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {
              return `\\\\?\\UNC\\${resolvedPath.slice(2)}`;
            }
          }
        } else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0)) && resolvedPath.charCodeAt(1) === CHAR_COLON && resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {
          return `\\\\?\\${resolvedPath}`;
        }
        return path7;
      },
      dirname(path7) {
        validateString(path7, "path");
        const len = path7.length;
        if (len === 0) {
          return ".";
        }
        let rootEnd = -1;
        let offset = 0;
        const code = path7.charCodeAt(0);
        if (len === 1) {
          return isPathSeparator(code) ? path7 : ".";
        }
        if (isPathSeparator(code)) {
          rootEnd = offset = 1;
          if (isPathSeparator(path7.charCodeAt(1))) {
            let j = 2;
            let last = j;
            while (j < len && !isPathSeparator(path7.charCodeAt(j))) {
              j++;
            }
            if (j < len && j !== last) {
              last = j;
              while (j < len && isPathSeparator(path7.charCodeAt(j))) {
                j++;
              }
              if (j < len && j !== last) {
                last = j;
                while (j < len && !isPathSeparator(path7.charCodeAt(j))) {
                  j++;
                }
                if (j === len) {
                  return path7;
                }
                if (j !== last) {
                  rootEnd = offset = j + 1;
                }
              }
            }
          }
        } else if (isWindowsDeviceRoot(code) && path7.charCodeAt(1) === CHAR_COLON) {
          rootEnd = len > 2 && isPathSeparator(path7.charCodeAt(2)) ? 3 : 2;
          offset = rootEnd;
        }
        let end = -1;
        let matchedSlash = true;
        for (let i = len - 1; i >= offset; --i) {
          if (isPathSeparator(path7.charCodeAt(i))) {
            if (!matchedSlash) {
              end = i;
              break;
            }
          } else {
            matchedSlash = false;
          }
        }
        if (end === -1) {
          if (rootEnd === -1) {
            return ".";
          }
          end = rootEnd;
        }
        return path7.slice(0, end);
      },
      basename(path7, suffix) {
        if (suffix !== void 0) {
          validateString(suffix, "suffix");
        }
        validateString(path7, "path");
        let start = 0;
        let end = -1;
        let matchedSlash = true;
        let i;
        if (path7.length >= 2 && isWindowsDeviceRoot(path7.charCodeAt(0)) && path7.charCodeAt(1) === CHAR_COLON) {
          start = 2;
        }
        if (suffix !== void 0 && suffix.length > 0 && suffix.length <= path7.length) {
          if (suffix === path7) {
            return "";
          }
          let extIdx = suffix.length - 1;
          let firstNonSlashEnd = -1;
          for (i = path7.length - 1; i >= start; --i) {
            const code = path7.charCodeAt(i);
            if (isPathSeparator(code)) {
              if (!matchedSlash) {
                start = i + 1;
                break;
              }
            } else {
              if (firstNonSlashEnd === -1) {
                matchedSlash = false;
                firstNonSlashEnd = i + 1;
              }
              if (extIdx >= 0) {
                if (code === suffix.charCodeAt(extIdx)) {
                  if (--extIdx === -1) {
                    end = i;
                  }
                } else {
                  extIdx = -1;
                  end = firstNonSlashEnd;
                }
              }
            }
          }
          if (start === end) {
            end = firstNonSlashEnd;
          } else if (end === -1) {
            end = path7.length;
          }
          return path7.slice(start, end);
        }
        for (i = path7.length - 1; i >= start; --i) {
          if (isPathSeparator(path7.charCodeAt(i))) {
            if (!matchedSlash) {
              start = i + 1;
              break;
            }
          } else if (end === -1) {
            matchedSlash = false;
            end = i + 1;
          }
        }
        if (end === -1) {
          return "";
        }
        return path7.slice(start, end);
      },
      extname(path7) {
        validateString(path7, "path");
        let start = 0;
        let startDot = -1;
        let startPart = 0;
        let end = -1;
        let matchedSlash = true;
        let preDotState = 0;
        if (path7.length >= 2 && path7.charCodeAt(1) === CHAR_COLON && isWindowsDeviceRoot(path7.charCodeAt(0))) {
          start = startPart = 2;
        }
        for (let i = path7.length - 1; i >= start; --i) {
          const code = path7.charCodeAt(i);
          if (isPathSeparator(code)) {
            if (!matchedSlash) {
              startPart = i + 1;
              break;
            }
            continue;
          }
          if (end === -1) {
            matchedSlash = false;
            end = i + 1;
          }
          if (code === CHAR_DOT) {
            if (startDot === -1) {
              startDot = i;
            } else if (preDotState !== 1) {
              preDotState = 1;
            }
          } else if (startDot !== -1) {
            preDotState = -1;
          }
        }
        if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
        preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
        preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
          return "";
        }
        return path7.slice(startDot, end);
      },
      format: _format2.bind(null, "\\"),
      parse(path7) {
        validateString(path7, "path");
        const ret = { root: "", dir: "", base: "", ext: "", name: "" };
        if (path7.length === 0) {
          return ret;
        }
        const len = path7.length;
        let rootEnd = 0;
        let code = path7.charCodeAt(0);
        if (len === 1) {
          if (isPathSeparator(code)) {
            ret.root = ret.dir = path7;
            return ret;
          }
          ret.base = ret.name = path7;
          return ret;
        }
        if (isPathSeparator(code)) {
          rootEnd = 1;
          if (isPathSeparator(path7.charCodeAt(1))) {
            let j = 2;
            let last = j;
            while (j < len && !isPathSeparator(path7.charCodeAt(j))) {
              j++;
            }
            if (j < len && j !== last) {
              last = j;
              while (j < len && isPathSeparator(path7.charCodeAt(j))) {
                j++;
              }
              if (j < len && j !== last) {
                last = j;
                while (j < len && !isPathSeparator(path7.charCodeAt(j))) {
                  j++;
                }
                if (j === len) {
                  rootEnd = j;
                } else if (j !== last) {
                  rootEnd = j + 1;
                }
              }
            }
          }
        } else if (isWindowsDeviceRoot(code) && path7.charCodeAt(1) === CHAR_COLON) {
          if (len <= 2) {
            ret.root = ret.dir = path7;
            return ret;
          }
          rootEnd = 2;
          if (isPathSeparator(path7.charCodeAt(2))) {
            if (len === 3) {
              ret.root = ret.dir = path7;
              return ret;
            }
            rootEnd = 3;
          }
        }
        if (rootEnd > 0) {
          ret.root = path7.slice(0, rootEnd);
        }
        let startDot = -1;
        let startPart = rootEnd;
        let end = -1;
        let matchedSlash = true;
        let i = path7.length - 1;
        let preDotState = 0;
        for (; i >= rootEnd; --i) {
          code = path7.charCodeAt(i);
          if (isPathSeparator(code)) {
            if (!matchedSlash) {
              startPart = i + 1;
              break;
            }
            continue;
          }
          if (end === -1) {
            matchedSlash = false;
            end = i + 1;
          }
          if (code === CHAR_DOT) {
            if (startDot === -1) {
              startDot = i;
            } else if (preDotState !== 1) {
              preDotState = 1;
            }
          } else if (startDot !== -1) {
            preDotState = -1;
          }
        }
        if (end !== -1) {
          if (startDot === -1 || // We saw a non-dot character immediately before the dot
          preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
          preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
            ret.base = ret.name = path7.slice(startPart, end);
          } else {
            ret.name = path7.slice(startPart, startDot);
            ret.base = path7.slice(startPart, end);
            ret.ext = path7.slice(startDot, end);
          }
        }
        if (startPart > 0 && startPart !== rootEnd) {
          ret.dir = path7.slice(0, startPart - 1);
        } else {
          ret.dir = ret.root;
        }
        return ret;
      },
      sep: "\\",
      delimiter: ";",
      win32: null,
      posix: null
    };
    posixCwd = (() => {
      if (platformIsWin32) {
        const regexp = /\\/g;
        return () => {
          const cwd3 = cwd().replace(regexp, "/");
          return cwd3.slice(cwd3.indexOf("/"));
        };
      }
      return () => cwd();
    })();
    $kc = {
      // path.resolve([from ...], to)
      resolve(...pathSegments) {
        let resolvedPath = "";
        let resolvedAbsolute = false;
        for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
          const path7 = i >= 0 ? pathSegments[i] : posixCwd();
          validateString(path7, `paths[${i}]`);
          if (path7.length === 0) {
            continue;
          }
          resolvedPath = `${path7}/${resolvedPath}`;
          resolvedAbsolute = path7.charCodeAt(0) === CHAR_FORWARD_SLASH;
        }
        resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator);
        if (resolvedAbsolute) {
          return `/${resolvedPath}`;
        }
        return resolvedPath.length > 0 ? resolvedPath : ".";
      },
      normalize(path7) {
        validateString(path7, "path");
        if (path7.length === 0) {
          return ".";
        }
        const isAbsolute2 = path7.charCodeAt(0) === CHAR_FORWARD_SLASH;
        const trailingSeparator = path7.charCodeAt(path7.length - 1) === CHAR_FORWARD_SLASH;
        path7 = normalizeString(path7, !isAbsolute2, "/", isPosixPathSeparator);
        if (path7.length === 0) {
          if (isAbsolute2) {
            return "/";
          }
          return trailingSeparator ? "./" : ".";
        }
        if (trailingSeparator) {
          path7 += "/";
        }
        return isAbsolute2 ? `/${path7}` : path7;
      },
      isAbsolute(path7) {
        validateString(path7, "path");
        return path7.length > 0 && path7.charCodeAt(0) === CHAR_FORWARD_SLASH;
      },
      join(...paths) {
        if (paths.length === 0) {
          return ".";
        }
        let joined;
        for (let i = 0; i < paths.length; ++i) {
          const arg = paths[i];
          validateString(arg, "path");
          if (arg.length > 0) {
            if (joined === void 0) {
              joined = arg;
            } else {
              joined += `/${arg}`;
            }
          }
        }
        if (joined === void 0) {
          return ".";
        }
        return $kc.normalize(joined);
      },
      relative(from, to) {
        validateString(from, "from");
        validateString(to, "to");
        if (from === to) {
          return "";
        }
        from = $kc.resolve(from);
        to = $kc.resolve(to);
        if (from === to) {
          return "";
        }
        const fromStart = 1;
        const fromEnd = from.length;
        const fromLen = fromEnd - fromStart;
        const toStart = 1;
        const toLen = to.length - toStart;
        const length = fromLen < toLen ? fromLen : toLen;
        let lastCommonSep = -1;
        let i = 0;
        for (; i < length; i++) {
          const fromCode = from.charCodeAt(fromStart + i);
          if (fromCode !== to.charCodeAt(toStart + i)) {
            break;
          } else if (fromCode === CHAR_FORWARD_SLASH) {
            lastCommonSep = i;
          }
        }
        if (i === length) {
          if (toLen > length) {
            if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) {
              return to.slice(toStart + i + 1);
            }
            if (i === 0) {
              return to.slice(toStart + i);
            }
          } else if (fromLen > length) {
            if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) {
              lastCommonSep = i;
            } else if (i === 0) {
              lastCommonSep = 0;
            }
          }
        }
        let out = "";
        for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
          if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) {
            out += out.length === 0 ? ".." : "/..";
          }
        }
        return `${out}${to.slice(toStart + lastCommonSep)}`;
      },
      toNamespacedPath(path7) {
        return path7;
      },
      dirname(path7) {
        validateString(path7, "path");
        if (path7.length === 0) {
          return ".";
        }
        const hasRoot = path7.charCodeAt(0) === CHAR_FORWARD_SLASH;
        let end = -1;
        let matchedSlash = true;
        for (let i = path7.length - 1; i >= 1; --i) {
          if (path7.charCodeAt(i) === CHAR_FORWARD_SLASH) {
            if (!matchedSlash) {
              end = i;
              break;
            }
          } else {
            matchedSlash = false;
          }
        }
        if (end === -1) {
          return hasRoot ? "/" : ".";
        }
        if (hasRoot && end === 1) {
          return "//";
        }
        return path7.slice(0, end);
      },
      basename(path7, suffix) {
        if (suffix !== void 0) {
          validateString(suffix, "ext");
        }
        validateString(path7, "path");
        let start = 0;
        let end = -1;
        let matchedSlash = true;
        let i;
        if (suffix !== void 0 && suffix.length > 0 && suffix.length <= path7.length) {
          if (suffix === path7) {
            return "";
          }
          let extIdx = suffix.length - 1;
          let firstNonSlashEnd = -1;
          for (i = path7.length - 1; i >= 0; --i) {
            const code = path7.charCodeAt(i);
            if (code === CHAR_FORWARD_SLASH) {
              if (!matchedSlash) {
                start = i + 1;
                break;
              }
            } else {
              if (firstNonSlashEnd === -1) {
                matchedSlash = false;
                firstNonSlashEnd = i + 1;
              }
              if (extIdx >= 0) {
                if (code === suffix.charCodeAt(extIdx)) {
                  if (--extIdx === -1) {
                    end = i;
                  }
                } else {
                  extIdx = -1;
                  end = firstNonSlashEnd;
                }
              }
            }
          }
          if (start === end) {
            end = firstNonSlashEnd;
          } else if (end === -1) {
            end = path7.length;
          }
          return path7.slice(start, end);
        }
        for (i = path7.length - 1; i >= 0; --i) {
          if (path7.charCodeAt(i) === CHAR_FORWARD_SLASH) {
            if (!matchedSlash) {
              start = i + 1;
              break;
            }
          } else if (end === -1) {
            matchedSlash = false;
            end = i + 1;
          }
        }
        if (end === -1) {
          return "";
        }
        return path7.slice(start, end);
      },
      extname(path7) {
        validateString(path7, "path");
        let startDot = -1;
        let startPart = 0;
        let end = -1;
        let matchedSlash = true;
        let preDotState = 0;
        for (let i = path7.length - 1; i >= 0; --i) {
          const code = path7.charCodeAt(i);
          if (code === CHAR_FORWARD_SLASH) {
            if (!matchedSlash) {
              startPart = i + 1;
              break;
            }
            continue;
          }
          if (end === -1) {
            matchedSlash = false;
            end = i + 1;
          }
          if (code === CHAR_DOT) {
            if (startDot === -1) {
              startDot = i;
            } else if (preDotState !== 1) {
              preDotState = 1;
            }
          } else if (startDot !== -1) {
            preDotState = -1;
          }
        }
        if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
        preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
        preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
          return "";
        }
        return path7.slice(startDot, end);
      },
      format: _format2.bind(null, "/"),
      parse(path7) {
        validateString(path7, "path");
        const ret = { root: "", dir: "", base: "", ext: "", name: "" };
        if (path7.length === 0) {
          return ret;
        }
        const isAbsolute2 = path7.charCodeAt(0) === CHAR_FORWARD_SLASH;
        let start;
        if (isAbsolute2) {
          ret.root = "/";
          start = 1;
        } else {
          start = 0;
        }
        let startDot = -1;
        let startPart = 0;
        let end = -1;
        let matchedSlash = true;
        let i = path7.length - 1;
        let preDotState = 0;
        for (; i >= start; --i) {
          const code = path7.charCodeAt(i);
          if (code === CHAR_FORWARD_SLASH) {
            if (!matchedSlash) {
              startPart = i + 1;
              break;
            }
            continue;
          }
          if (end === -1) {
            matchedSlash = false;
            end = i + 1;
          }
          if (code === CHAR_DOT) {
            if (startDot === -1) {
              startDot = i;
            } else if (preDotState !== 1) {
              preDotState = 1;
            }
          } else if (startDot !== -1) {
            preDotState = -1;
          }
        }
        if (end !== -1) {
          const start2 = startPart === 0 && isAbsolute2 ? 1 : startPart;
          if (startDot === -1 || // We saw a non-dot character immediately before the dot
          preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
          preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
            ret.base = ret.name = path7.slice(start2, end);
          } else {
            ret.name = path7.slice(start2, startDot);
            ret.base = path7.slice(start2, end);
            ret.ext = path7.slice(startDot, end);
          }
        }
        if (startPart > 0) {
          ret.dir = path7.slice(0, startPart - 1);
        } else if (isAbsolute2) {
          ret.dir = "/";
        }
        return ret;
      },
      sep: "/",
      delimiter: ":",
      win32: null,
      posix: null
    };
    $kc.win32 = $jc.win32 = $jc;
    $kc.posix = $jc.posix = $kc;
    $lc = platformIsWin32 ? $jc.normalize : $kc.normalize;
    $mc = platformIsWin32 ? $jc.isAbsolute : $kc.isAbsolute;
    $nc = platformIsWin32 ? $jc.join : $kc.join;
    $oc = platformIsWin32 ? $jc.resolve : $kc.resolve;
    $pc = platformIsWin32 ? $jc.relative : $kc.relative;
    $qc = platformIsWin32 ? $jc.dirname : $kc.dirname;
    $rc = platformIsWin32 ? $jc.basename : $kc.basename;
    $sc = platformIsWin32 ? $jc.extname : $kc.extname;
    $tc = platformIsWin32 ? $jc.format : $kc.format;
    $uc = platformIsWin32 ? $jc.parse : $kc.parse;
    $vc = platformIsWin32 ? $jc.toNamespacedPath : $kc.toNamespacedPath;
    sep = platformIsWin32 ? $jc.sep : $kc.sep;
    $xc = platformIsWin32 ? $jc.delimiter : $kc.delimiter;
  }
});

// out-build/vs/base/common/uri.js
function _validateUri(ret, _strict) {
  if (!ret.scheme && _strict) {
    throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${ret.authority}", path: "${ret.path}", query: "${ret.query}", fragment: "${ret.fragment}"}`);
  }
  if (ret.scheme && !_schemePattern.test(ret.scheme)) {
    throw new Error("[UriError]: Scheme contains illegal characters.");
  }
  if (ret.path) {
    if (ret.authority) {
      if (!_singleSlashStart.test(ret.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 (_doubleSlashStart.test(ret.path)) {
        throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")');
      }
    }
  }
}
function _schemeFix(scheme, _strict) {
  if (!scheme && !_strict) {
    return "file";
  }
  return scheme;
}
function _referenceResolution(scheme, path7) {
  switch (scheme) {
    case "https":
    case "http":
    case "file":
      if (!path7) {
        path7 = _slash;
      } else if (path7[0] !== _slash) {
        path7 = _slash + path7;
      }
      break;
  }
  return path7;
}
function $zc(thing) {
  if (!thing || typeof thing !== "object") {
    return false;
  }
  return typeof thing.scheme === "string" && (typeof thing.authority === "string" || typeof thing.authority === "undefined") && (typeof thing.path === "string" || typeof thing.path === "undefined") && (typeof thing.query === "string" || typeof thing.query === "undefined") && (typeof thing.fragment === "string" || typeof thing.fragment === "undefined");
}
function encodeURIComponentFast(uriComponent, isPath, isAuthority) {
  let res = void 0;
  let nativeEncodePos = -1;
  for (let pos = 0; pos < uriComponent.length; pos++) {
    const code = uriComponent.charCodeAt(pos);
    if (code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57 || code === 45 || code === 46 || code === 95 || code === 126 || isPath && code === 47 || isAuthority && code === 91 || isAuthority && code === 93 || isAuthority && code === 58) {
      if (nativeEncodePos !== -1) {
        res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));
        nativeEncodePos = -1;
      }
      if (res !== void 0) {
        res += uriComponent.charAt(pos);
      }
    } else {
      if (res === void 0) {
        res = uriComponent.substr(0, pos);
      }
      const escaped = encodeTable[code];
      if (escaped !== void 0) {
        if (nativeEncodePos !== -1) {
          res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));
          nativeEncodePos = -1;
        }
        res += escaped;
      } else if (nativeEncodePos === -1) {
        nativeEncodePos = pos;
      }
    }
  }
  if (nativeEncodePos !== -1) {
    res += encodeURIComponent(uriComponent.substring(nativeEncodePos));
  }
  return res !== void 0 ? res : uriComponent;
}
function encodeURIComponentMinimal(path7) {
  let res = void 0;
  for (let pos = 0; pos < path7.length; pos++) {
    const code = path7.charCodeAt(pos);
    if (code === 35 || code === 63) {
      if (res === void 0) {
        res = path7.substr(0, pos);
      }
      res += encodeTable[code];
    } else {
      if (res !== void 0) {
        res += path7[pos];
      }
    }
  }
  return res !== void 0 ? res : path7;
}
function $Ac(uri, keepDriveLetterCasing) {
  let value;
  if (uri.authority && uri.path.length > 1 && uri.scheme === "file") {
    value = `//${uri.authority}${uri.path}`;
  } else if (uri.path.charCodeAt(0) === 47 && (uri.path.charCodeAt(1) >= 65 && uri.path.charCodeAt(1) <= 90 || uri.path.charCodeAt(1) >= 97 && uri.path.charCodeAt(1) <= 122) && uri.path.charCodeAt(2) === 58) {
    if (!keepDriveLetterCasing) {
      value = uri.path[1].toLowerCase() + uri.path.substr(2);
    } else {
      value = uri.path.substr(1);
    }
  } else {
    value = uri.path;
  }
  if ($l) {
    value = value.replace(/\//g, "\\");
  }
  return value;
}
function _asFormatted(uri, skipEncoding) {
  const encoder = !skipEncoding ? encodeURIComponentFast : encodeURIComponentMinimal;
  let res = "";
  let { scheme, authority, path: path7, query, fragment } = uri;
  if (scheme) {
    res += scheme;
    res += ":";
  }
  if (authority || scheme === "file") {
    res += _slash;
    res += _slash;
  }
  if (authority) {
    let idx = authority.indexOf("@");
    if (idx !== -1) {
      const userinfo = authority.substr(0, idx);
      authority = authority.substr(idx + 1);
      idx = userinfo.lastIndexOf(":");
      if (idx === -1) {
        res += encoder(userinfo, false, false);
      } else {
        res += encoder(userinfo.substr(0, idx), false, false);
        res += ":";
        res += encoder(userinfo.substr(idx + 1), false, true);
      }
      res += "@";
    }
    authority = authority.toLowerCase();
    idx = authority.lastIndexOf(":");
    if (idx === -1) {
      res += encoder(authority, false, true);
    } else {
      res += encoder(authority.substr(0, idx), false, true);
      res += authority.substr(idx);
    }
  }
  if (path7) {
    if (path7.length >= 3 && path7.charCodeAt(0) === 47 && path7.charCodeAt(2) === 58) {
      const code = path7.charCodeAt(1);
      if (code >= 65 && code <= 90) {
        path7 = `/${String.fromCharCode(code + 32)}:${path7.substr(3)}`;
      }
    } else if (path7.length >= 2 && path7.charCodeAt(1) === 58) {
      const code = path7.charCodeAt(0);
      if (code >= 65 && code <= 90) {
        path7 = `${String.fromCharCode(code + 32)}:${path7.substr(2)}`;
      }
    }
    res += encoder(path7, true, false);
  }
  if (query) {
    res += "?";
    res += encoder(query, false, false);
  }
  if (fragment) {
    res += "#";
    res += !skipEncoding ? encodeURIComponentFast(fragment, false, false) : fragment;
  }
  return res;
}
function decodeURIComponentGraceful(str) {
  try {
    return decodeURIComponent(str);
  } catch {
    if (str.length > 3) {
      return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));
    } else {
      return str;
    }
  }
}
function percentDecode(str) {
  if (!str.match(_rEncodedAsHex)) {
    return str;
  }
  return str.replace(_rEncodedAsHex, (match) => decodeURIComponentGraceful(match));
}
var _schemePattern, _singleSlashStart, _doubleSlashStart, _empty, _slash, _regexp, URI, _pathSepMarker, Uri, encodeTable, _rEncodedAsHex;
var init_uri = __esm({
  "out-build/vs/base/common/uri.js"() {
    "use strict";
    init_path();
    init_platform();
    _schemePattern = /^\w[\w\d+.-]*$/;
    _singleSlashStart = /^\//;
    _doubleSlashStart = /^\/\//;
    _empty = "";
    _slash = "/";
    _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
    URI = class _URI {
      static isUri(thing) {
        if (thing instanceof _URI) {
          return true;
        }
        if (!thing) {
          return false;
        }
        return typeof thing.authority === "string" && typeof thing.fragment === "string" && typeof thing.path === "string" && typeof thing.query === "string" && typeof thing.scheme === "string" && typeof thing.fsPath === "string" && typeof thing.with === "function" && typeof thing.toString === "function";
      }
      /**
       * @internal
       */
      constructor(schemeOrData, authority, path7, query, fragment, _strict = false) {
        if (typeof schemeOrData === "object") {
          this.scheme = schemeOrData.scheme || _empty;
          this.authority = schemeOrData.authority || _empty;
          this.path = schemeOrData.path || _empty;
          this.query = schemeOrData.query || _empty;
          this.fragment = schemeOrData.fragment || _empty;
        } else {
          this.scheme = _schemeFix(schemeOrData, _strict);
          this.authority = authority || _empty;
          this.path = _referenceResolution(this.scheme, path7 || _empty);
          this.query = query || _empty;
          this.fragment = fragment || _empty;
          _validateUri(this, _strict);
        }
      }
      // ---- filesystem path -----------------------
      /**
       * Returns a string representing the corresponding file system path of this URI.
       * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
       * platform specific path separator.
       *
       * * Will *not* validate the path for invalid characters and semantics.
       * * Will *not* look at the scheme of this URI.
       * * The result shall *not* be used for display purposes but for accessing a file on disk.
       *
       *
       * The *difference* to `URI#path` is the use of the platform specific separator and the handling
       * of UNC paths. See the below sample of a file-uri with an authority (UNC path).
       *
       * ```ts
          const u = URI.parse('file://server/c$/folder/file.txt')
          u.authority === 'server'
          u.path === '/shares/c$/file.txt'
          u.fsPath === '\\server\c$\folder\file.txt'
      ```
       *
       * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,
       * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working
       * with URIs that represent files on disk (`file` scheme).
       */
      get fsPath() {
        return $Ac(this, false);
      }
      // ---- modify to new -------------------------
      with(change) {
        if (!change) {
          return this;
        }
        let { scheme, authority, path: path7, query, fragment } = change;
        if (scheme === void 0) {
          scheme = this.scheme;
        } else if (scheme === null) {
          scheme = _empty;
        }
        if (authority === void 0) {
          authority = this.authority;
        } else if (authority === null) {
          authority = _empty;
        }
        if (path7 === void 0) {
          path7 = this.path;
        } else if (path7 === null) {
          path7 = _empty;
        }
        if (query === void 0) {
          query = this.query;
        } else if (query === null) {
          query = _empty;
        }
        if (fragment === void 0) {
          fragment = this.fragment;
        } else if (fragment === null) {
          fragment = _empty;
        }
        if (scheme === this.scheme && authority === this.authority && path7 === this.path && query === this.query && fragment === this.fragment) {
          return this;
        }
        return new Uri(scheme, authority, path7, query, fragment);
      }
      // ---- parse & validate ------------------------
      /**
       * Creates a new URI from a string, e.g. `http://www.example.com/some/path`,
       * `file:///usr/home`, or `scheme:with/path`.
       *
       * @param value A string which represents an URI (see `URI#toString`).
       */
      static parse(value, _strict = false) {
        const match = _regexp.exec(value);
        if (!match) {
          return new Uri(_empty, _empty, _empty, _empty, _empty);
        }
        return new Uri(match[2] || _empty, percentDecode(match[4] || _empty), percentDecode(match[5] || _empty), percentDecode(match[7] || _empty), percentDecode(match[9] || _empty), _strict);
      }
      /**
       * Creates a new URI from a file system path, e.g. `c:\my\files`,
       * `/usr/home`, or `\\server\share\some\path`.
       *
       * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument
       * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**
       * `URI.parse('file://' + path)` because the path might contain characters that are
       * interpreted (# and ?). See the following sample:
       * ```ts
      const good = URI.file('/coding/c#/project1');
      good.scheme === 'file';
      good.path === '/coding/c#/project1';
      good.fragment === '';
      const bad = URI.parse('file://' + '/coding/c#/project1');
      bad.scheme === 'file';
      bad.path === '/coding/c'; // path is now broken
      bad.fragment === '/project1';
      ```
       *
       * @param path A file system path (see `URI#fsPath`)
       */
      static file(path7) {
        let authority = _empty;
        if ($l) {
          path7 = path7.replace(/\\/g, _slash);
        }
        if (path7[0] === _slash && path7[1] === _slash) {
          const idx = path7.indexOf(_slash, 2);
          if (idx === -1) {
            authority = path7.substring(2);
            path7 = _slash;
          } else {
            authority = path7.substring(2, idx);
            path7 = path7.substring(idx) || _slash;
          }
        }
        return new Uri("file", authority, path7, _empty, _empty);
      }
      /**
       * Creates new URI from uri components.
       *
       * Unless `strict` is `true` the scheme is defaults to be `file`. This function performs
       * validation and should be used for untrusted uri components retrieved from storage,
       * user input, command arguments etc
       */
      static from(components, strict) {
        const result = new Uri(components.scheme, components.authority, components.path, components.query, components.fragment, strict);
        return result;
      }
      /**
       * Join a URI path with path fragments and normalizes the resulting path.
       *
       * @param uri The input URI.
       * @param pathFragment The path fragment to add to the URI path.
       * @returns The resulting URI.
       */
      static joinPath(uri, ...pathFragment) {
        if (!uri.path) {
          throw new Error(`[UriError]: cannot call joinPath on URI without path`);
        }
        let newPath;
        if ($l && uri.scheme === "file") {
          newPath = _URI.file($jc.join($Ac(uri, true), ...pathFragment)).path;
        } else {
          newPath = $kc.join(uri.path, ...pathFragment);
        }
        return uri.with({ path: newPath });
      }
      // ---- printing/externalize ---------------------------
      /**
       * Creates a string representation for this URI. It's guaranteed that calling
       * `URI.parse` with the result of this function creates an URI which is equal
       * to this URI.
       *
       * * The result shall *not* be used for display purposes but for externalization or transport.
       * * The result will be encoded using the percentage encoding and encoding happens mostly
       * ignore the scheme-specific encoding rules.
       *
       * @param skipEncoding Do not encode the result, default is `false`
       */
      toString(skipEncoding = false) {
        return _asFormatted(this, skipEncoding);
      }
      toJSON() {
        return this;
      }
      static revive(data) {
        if (!data) {
          return data;
        } else if (data instanceof _URI) {
          return data;
        } else {
          const result = new Uri(data);
          result._formatted = data.external ?? null;
          result._fsPath = data._sep === _pathSepMarker ? data.fsPath ?? null : null;
          return result;
        }
      }
      [Symbol.for("debug.description")]() {
        return `URI(${this.toString()})`;
      }
    };
    _pathSepMarker = $l ? 1 : void 0;
    Uri = class extends URI {
      constructor() {
        super(...arguments);
        this._formatted = null;
        this._fsPath = null;
      }
      get fsPath() {
        if (!this._fsPath) {
          this._fsPath = $Ac(this, false);
        }
        return this._fsPath;
      }
      toString(skipEncoding = false) {
        if (!skipEncoding) {
          if (!this._formatted) {
            this._formatted = _asFormatted(this, false);
          }
          return this._formatted;
        } else {
          return _asFormatted(this, true);
        }
      }
      toJSON() {
        const res = {
          $mid: 1
          /* MarshalledId.Uri */
        };
        if (this._fsPath) {
          res.fsPath = this._fsPath;
          res._sep = _pathSepMarker;
        }
        if (this._formatted) {
          res.external = this._formatted;
        }
        if (this.path) {
          res.path = this.path;
        }
        if (this.scheme) {
          res.scheme = this.scheme;
        }
        if (this.authority) {
          res.authority = this.authority;
        }
        if (this.query) {
          res.query = this.query;
        }
        if (this.fragment) {
          res.fragment = this.fragment;
        }
        return res;
      }
    };
    encodeTable = {
      [
        58
        /* CharCode.Colon */
      ]: "%3A",
      // gen-delims
      [
        47
        /* CharCode.Slash */
      ]: "%2F",
      [
        63
        /* CharCode.QuestionMark */
      ]: "%3F",
      [
        35
        /* CharCode.Hash */
      ]: "%23",
      [
        91
        /* CharCode.OpenSquareBracket */
      ]: "%5B",
      [
        93
        /* CharCode.CloseSquareBracket */
      ]: "%5D",
      [
        64
        /* CharCode.AtSign */
      ]: "%40",
      [
        33
        /* CharCode.ExclamationMark */
      ]: "%21",
      // sub-delims
      [
        36
        /* CharCode.DollarSign */
      ]: "%24",
      [
        38
        /* CharCode.Ampersand */
      ]: "%26",
      [
        39
        /* CharCode.SingleQuote */
      ]: "%27",
      [
        40
        /* CharCode.OpenParen */
      ]: "%28",
      [
        41
        /* CharCode.CloseParen */
      ]: "%29",
      [
        42
        /* CharCode.Asterisk */
      ]: "%2A",
      [
        43
        /* CharCode.Plus */
      ]: "%2B",
      [
        44
        /* CharCode.Comma */
      ]: "%2C",
      [
        59
        /* CharCode.Semicolon */
      ]: "%3B",
      [
        61
        /* CharCode.Equals */
      ]: "%3D",
      [
        32
        /* CharCode.Space */
      ]: "%20"
    };
    _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;
  }
});

// out-build/vs/base/common/network.js
function $ch(product2, basePath) {
  return $kc.join(basePath ?? "/", `${product2.quality ?? "oss"}-${product2.commit ?? "dev"}`);
}
var Schemas, $_g, $ah, RemoteAuthoritiesImpl, $bh, $dh, $eh, $fh, $hh, FileAccessImpl, $ih, COI;
var init_network = __esm({
  "out-build/vs/base/common/network.js"() {
    "use strict";
    init_errors();
    init_platform();
    init_strings();
    init_uri();
    init_path();
    (function(Schemas2) {
      Schemas2.inMemory = "inmemory";
      Schemas2.vscode = "vscode";
      Schemas2.internal = "private";
      Schemas2.walkThrough = "walkThrough";
      Schemas2.walkThroughSnippet = "walkThroughSnippet";
      Schemas2.http = "http";
      Schemas2.https = "https";
      Schemas2.file = "file";
      Schemas2.mailto = "mailto";
      Schemas2.untitled = "untitled";
      Schemas2.data = "data";
      Schemas2.command = "command";
      Schemas2.vscodeRemote = "vscode-remote";
      Schemas2.vscodeRemoteResource = "vscode-remote-resource";
      Schemas2.vscodeManagedRemoteResource = "vscode-managed-remote-resource";
      Schemas2.vscodeUserData = "vscode-userdata";
      Schemas2.vscodeCustomEditor = "vscode-custom-editor";
      Schemas2.vscodeNotebookCell = "vscode-notebook-cell";
      Schemas2.vscodeNotebookCellMetadata = "vscode-notebook-cell-metadata";
      Schemas2.vscodeNotebookCellMetadataDiff = "vscode-notebook-cell-metadata-diff";
      Schemas2.vscodeNotebookCellOutput = "vscode-notebook-cell-output";
      Schemas2.vscodeNotebookCellOutputDiff = "vscode-notebook-cell-output-diff";
      Schemas2.vscodeNotebookMetadata = "vscode-notebook-metadata";
      Schemas2.vscodeInteractiveInput = "vscode-interactive-input";
      Schemas2.vscodeSettings = "vscode-settings";
      Schemas2.vscodeWorkspaceTrust = "vscode-workspace-trust";
      Schemas2.vscodeTerminal = "vscode-terminal";
      Schemas2.vscodeChatCodeBlock = "vscode-chat-code-block";
      Schemas2.vscodeChatCodeCompareBlock = "vscode-chat-code-compare-block";
      Schemas2.vscodeChatSesssion = "vscode-chat-editor";
      Schemas2.webviewPanel = "webview-panel";
      Schemas2.vscodeWebview = "vscode-webview";
      Schemas2.extension = "extension";
      Schemas2.vscodeFileResource = "vscode-file";
      Schemas2.tmp = "tmp";
      Schemas2.vsls = "vsls";
      Schemas2.vscodeSourceControl = "vscode-scm";
      Schemas2.commentsInput = "comment";
      Schemas2.codeSetting = "code-setting";
      Schemas2.outputChannel = "output";
      Schemas2.accessibleView = "accessible-view";
    })(Schemas || (Schemas = {}));
    $_g = "vscode-tkn";
    $ah = "tkn";
    RemoteAuthoritiesImpl = class {
      constructor() {
        this.a = /* @__PURE__ */ Object.create(null);
        this.b = /* @__PURE__ */ Object.create(null);
        this.c = /* @__PURE__ */ Object.create(null);
        this.d = "http";
        this.e = null;
        this.f = "/";
      }
      setPreferredWebSchema(schema) {
        this.d = schema;
      }
      setDelegate(delegate) {
        this.e = delegate;
      }
      setServerRootPath(product2, serverBasePath) {
        this.f = $ch(product2, serverBasePath);
      }
      getServerRootPath() {
        return this.f;
      }
      get g() {
        return $kc.join(this.f, Schemas.vscodeRemoteResource);
      }
      set(authority, host, port) {
        this.a[authority] = host;
        this.b[authority] = port;
      }
      setConnectionToken(authority, connectionToken) {
        this.c[authority] = connectionToken;
      }
      getPreferredWebSchema() {
        return this.d;
      }
      rewrite(uri) {
        if (this.e) {
          try {
            return this.e(uri);
          } catch (err) {
            $gb(err);
            return uri;
          }
        }
        const authority = uri.authority;
        let host = this.a[authority];
        if (host && host.indexOf(":") !== -1 && host.indexOf("[") === -1) {
          host = `[${host}]`;
        }
        const port = this.b[authority];
        const connectionToken = this.c[authority];
        let query = `path=${encodeURIComponent(uri.path)}`;
        if (typeof connectionToken === "string") {
          query += `&${$ah}=${encodeURIComponent(connectionToken)}`;
        }
        return URI.from({
          scheme: $r ? this.d : Schemas.vscodeRemoteResource,
          authority: `${host}:${port}`,
          path: $r ? (window.location.pathname + "/" + this.g).replace(/\/\/+/g, "/") : this.g,
          query
        });
      }
    };
    $bh = new RemoteAuthoritiesImpl();
    $dh = "vs/../../extensions";
    $eh = "vs/../../node_modules";
    $fh = "vs/../../node_modules.asar";
    $hh = "vscode-app";
    FileAccessImpl = class _FileAccessImpl {
      static {
        this.a = $hh;
      }
      /**
       * Returns a URI to use in contexts where the browser is responsible
       * for loading (e.g. fetch()) or when used within the DOM.
       *
       * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.
       */
      asBrowserUri(resourcePath) {
        const uri = this.b(resourcePath);
        return this.uriToBrowserUri(uri);
      }
      /**
       * Returns a URI to use in contexts where the browser is responsible
       * for loading (e.g. fetch()) or when used within the DOM.
       *
       * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.
       */
      uriToBrowserUri(uri) {
        if (uri.scheme === Schemas.vscodeRemote) {
          return $bh.rewrite(uri);
        }
        if (
          // ...only ever for `file` resources
          uri.scheme === Schemas.file && // ...and we run in native environments
          ($p || // ...or web worker extensions on desktop
          $t === `${Schemas.vscodeFileResource}://${_FileAccessImpl.a}`)
        ) {
          return uri.with({
            scheme: Schemas.vscodeFileResource,
            // We need to provide an authority here so that it can serve
            // as origin for network and loading matters in chromium.
            // If the URI is not coming with an authority already, we
            // add our own
            authority: uri.authority || _FileAccessImpl.a,
            query: null,
            fragment: null
          });
        }
        return uri;
      }
      /**
       * Returns the `file` URI to use in contexts where node.js
       * is responsible for loading.
       */
      asFileUri(resourcePath) {
        const uri = this.b(resourcePath);
        return this.uriToFileUri(uri);
      }
      /**
       * Returns the `file` URI to use in contexts where node.js
       * is responsible for loading.
       */
      uriToFileUri(uri) {
        if (uri.scheme === Schemas.vscodeFileResource) {
          return uri.with({
            scheme: Schemas.file,
            // Only preserve the `authority` if it is different from
            // our fallback authority. This ensures we properly preserve
            // Windows UNC paths that come with their own authority.
            authority: uri.authority !== _FileAccessImpl.a ? uri.authority : null,
            query: null,
            fragment: null
          });
        }
        return uri;
      }
      b(uriOrModule, moduleIdToUrl) {
        if (URI.isUri(uriOrModule)) {
          return uriOrModule;
        }
        if (globalThis._VSCODE_FILE_ROOT) {
          const rootUriOrPath = globalThis._VSCODE_FILE_ROOT;
          if (/^\w[\w\d+.-]*:\/\//.test(rootUriOrPath)) {
            return URI.joinPath(URI.parse(rootUriOrPath, true), uriOrModule);
          }
          const modulePath = $nc(rootUriOrPath, uriOrModule);
          return URI.file(modulePath);
        }
        return URI.parse(moduleIdToUrl.toUrl(uriOrModule));
      }
    };
    $ih = new FileAccessImpl();
    (function(COI2) {
      const coiHeaders = /* @__PURE__ */ 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" }]
      ]);
      COI2.CoopAndCoep = Object.freeze(coiHeaders.get("3"));
      const coiSearchParamName = "vscode-coi";
      function getHeadersFromQuery(url3) {
        let params;
        if (typeof url3 === "string") {
          params = new URL(url3).searchParams;
        } else if (url3 instanceof URL) {
          params = url3.searchParams;
        } else if (URI.isUri(url3)) {
          params = new URL(url3.toString(true)).searchParams;
        }
        const value = params?.get(coiSearchParamName);
        if (!value) {
          return void 0;
        }
        return coiHeaders.get(value);
      }
      COI2.getHeadersFromQuery = getHeadersFromQuery;
      function addSearchParam(urlOrSearch, coop, coep) {
        if (!globalThis.crossOriginIsolated) {
          return;
        }
        const value = coop && coep ? "3" : coep ? "2" : "1";
        if (urlOrSearch instanceof URLSearchParams) {
          urlOrSearch.set(coiSearchParamName, value);
        } else {
          urlOrSearch[coiSearchParamName] = value;
        }
      }
      COI2.addSearchParam = addSearchParam;
    })(COI || (COI = {}));
  }
});

// out-build/vs/platform/instantiation/common/serviceCollection.js
var $Ok;
var init_serviceCollection = __esm({
  "out-build/vs/platform/instantiation/common/serviceCollection.js"() {
    "use strict";
    $Ok = class {
      constructor(...entries) {
        this.a = /* @__PURE__ */ new Map();
        for (const [id2, service] of entries) {
          this.set(id2, service);
        }
      }
      set(id2, instanceOrDescriptor) {
        const result = this.a.get(id2);
        this.a.set(id2, instanceOrDescriptor);
        return result;
      }
      has(id2) {
        return this.a.has(id2);
      }
      get(id2) {
        return this.a.get(id2);
      }
    };
  }
});

// out-build/vs/base/common/types.js
function $zg(str) {
  return typeof str === "string";
}
function $Bg(obj) {
  return typeof obj === "object" && obj !== null && !Array.isArray(obj) && !(obj instanceof RegExp) && !(obj instanceof Date);
}
function $Cg(obj) {
  const TypedArray = Object.getPrototypeOf(Uint8Array);
  return typeof obj === "object" && obj instanceof TypedArray;
}
function $Dg(obj) {
  return typeof obj === "number" && !isNaN(obj);
}
function $Fg(obj) {
  return obj === true || obj === false;
}
function $Gg(obj) {
  return typeof obj === "undefined";
}
function $Hg(arg) {
  return !$Ig(arg);
}
function $Ig(obj) {
  return $Gg(obj) || obj === null;
}
function $Kg(arg) {
  if ($Ig(arg)) {
    throw new Error("Assertion Failed: argument is undefined or null");
  }
  return arg;
}
function $Mg(obj) {
  if (!$Bg(obj)) {
    return false;
  }
  for (const key in obj) {
    if (hasOwnProperty.call(obj, key)) {
      return false;
    }
  }
  return true;
}
function $Ng(obj) {
  return typeof obj === "function";
}
function $Qg(arg, constraint) {
  if ($zg(constraint)) {
    if (typeof arg !== constraint) {
      throw new Error(`argument does not match constraint: typeof ${constraint}`);
    }
  } else if ($Ng(constraint)) {
    try {
      if (arg instanceof constraint) {
        return;
      }
    } catch {
    }
    if (!$Ig(arg) && arg.constructor === constraint) {
      return;
    }
    if (constraint.length === 1 && constraint.call(void 0, arg) === true) {
      return;
    }
    throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`);
  }
}
var hasOwnProperty;
var init_types = __esm({
  "out-build/vs/base/common/types.js"() {
    "use strict";
    hasOwnProperty = Object.prototype.hasOwnProperty;
  }
});

// out-build/vs/base/common/errorMessage.js
function exceptionToErrorMessage(exception, verbose) {
  if (verbose && (exception.stack || exception.stacktrace)) {
    return localize(110, null, detectSystemErrorMessage(exception), stackToString(exception.stack) || stackToString(exception.stacktrace));
  }
  return detectSystemErrorMessage(exception);
}
function stackToString(stack) {
  if (Array.isArray(stack)) {
    return stack.join("\n");
  }
  return stack;
}
function detectSystemErrorMessage(exception) {
  if (exception.code === "ERR_UNC_HOST_NOT_ALLOWED") {
    return `${exception.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`;
  }
  if (typeof exception.code === "string" && typeof exception.errno === "number" && typeof exception.syscall === "string") {
    return localize(111, null, exception.message);
  }
  return exception.message || localize(112, null);
}
function $1m(error = null, verbose = false) {
  if (!error) {
    return localize(113, null);
  }
  if (Array.isArray(error)) {
    const errors = $Mb(error);
    const msg = $1m(errors[0], verbose);
    if (errors.length > 1) {
      return localize(114, null, msg, errors.length);
    }
    return msg;
  }
  if ($zg(error)) {
    return error;
  }
  if (error.detail) {
    const detail = error.detail;
    if (detail.error) {
      return exceptionToErrorMessage(detail.error, verbose);
    }
    if (detail.exception) {
      return exceptionToErrorMessage(detail.exception, verbose);
    }
  }
  if (error.stack) {
    return exceptionToErrorMessage(error, verbose);
  }
  if (error.message) {
    return error.message;
  }
  return localize(115, null);
}
var init_errorMessage = __esm({
  "out-build/vs/base/common/errorMessage.js"() {
    "use strict";
    init_arrays();
    init_types();
    init_nls2();
  }
});

// out-build/vs/base/common/stream.js
function $oi(obj) {
  const candidate = obj;
  if (!candidate) {
    return false;
  }
  return [candidate.on, candidate.pause, candidate.resume, candidate.destroy].every((fn) => typeof fn === "function");
}
function $pi(obj) {
  const candidate = obj;
  if (!candidate) {
    return false;
  }
  return $oi(candidate.stream) && Array.isArray(candidate.buffer) && typeof candidate.ended === "boolean";
}
function $qi(reducer, options2) {
  return new WriteableStreamImpl(reducer, options2);
}
function $ri(readable, reducer) {
  const chunks = [];
  let chunk;
  while ((chunk = readable.read()) !== null) {
    chunks.push(chunk);
  }
  return reducer(chunks);
}
function $si(readable, reducer, maxChunks) {
  const chunks = [];
  let chunk = void 0;
  while ((chunk = readable.read()) !== null && chunks.length < maxChunks) {
    chunks.push(chunk);
  }
  if (chunk === null && chunks.length > 0) {
    return reducer(chunks);
  }
  return {
    read: () => {
      if (chunks.length > 0) {
        return chunks.shift();
      }
      if (typeof chunk !== "undefined") {
        const lastReadChunk = chunk;
        chunk = void 0;
        return lastReadChunk;
      }
      return readable.read();
    }
  };
}
function $ti(stream, reducer) {
  return new Promise((resolve4, reject) => {
    const chunks = [];
    $ui(stream, {
      onData: (chunk) => {
        if (reducer) {
          chunks.push(chunk);
        }
      },
      onError: (error) => {
        if (reducer) {
          reject(error);
        } else {
          resolve4(void 0);
        }
      },
      onEnd: () => {
        if (reducer) {
          resolve4(reducer(chunks));
        } else {
          resolve4(void 0);
        }
      }
    });
  });
}
function $ui(stream, listener, token) {
  stream.on("error", (error) => {
    if (!token?.isCancellationRequested) {
      listener.onError(error);
    }
  });
  stream.on("end", () => {
    if (!token?.isCancellationRequested) {
      listener.onEnd();
    }
  });
  stream.on("data", (data) => {
    if (!token?.isCancellationRequested) {
      listener.onData(data);
    }
  });
}
function $vi(stream, maxChunks) {
  return new Promise((resolve4, reject) => {
    const streamListeners = new $2c();
    const buffer = [];
    const dataListener = (chunk) => {
      buffer.push(chunk);
      if (buffer.length > maxChunks) {
        streamListeners.dispose();
        stream.pause();
        return resolve4({ stream, buffer, ended: false });
      }
    };
    const errorListener = (error) => {
      streamListeners.dispose();
      return reject(error);
    };
    const endListener = () => {
      streamListeners.dispose();
      return resolve4({ stream, buffer, ended: true });
    };
    streamListeners.add($1c(() => stream.removeListener("error", errorListener)));
    stream.on("error", errorListener);
    streamListeners.add($1c(() => stream.removeListener("end", endListener)));
    stream.on("end", endListener);
    streamListeners.add($1c(() => stream.removeListener("data", dataListener)));
    stream.on("data", dataListener);
  });
}
function $yi(t) {
  let consumed = false;
  return {
    read: () => {
      if (consumed) {
        return null;
      }
      consumed = true;
      return t;
    }
  };
}
function $zi(stream, transformer, reducer) {
  const target = $qi(reducer);
  $ui(stream, {
    onData: (data) => target.write(transformer.data(data)),
    onError: (error) => target.error(transformer.error ? transformer.error(error) : error),
    onEnd: () => target.end()
  });
  return target;
}
var WriteableStreamImpl;
var init_stream = __esm({
  "out-build/vs/base/common/stream.js"() {
    "use strict";
    init_errors();
    init_lifecycle();
    WriteableStreamImpl = class {
      constructor(e, f) {
        this.e = e;
        this.f = f;
        this.a = {
          flowing: false,
          ended: false,
          destroyed: false
        };
        this.b = {
          data: [],
          error: []
        };
        this.c = {
          data: [],
          error: [],
          end: []
        };
        this.d = [];
      }
      pause() {
        if (this.a.destroyed) {
          return;
        }
        this.a.flowing = false;
      }
      resume() {
        if (this.a.destroyed) {
          return;
        }
        if (!this.a.flowing) {
          this.a.flowing = true;
          this.j();
          this.k();
          this.l();
        }
      }
      write(data) {
        if (this.a.destroyed) {
          return;
        }
        if (this.a.flowing) {
          this.g(data);
        } else {
          this.b.data.push(data);
          if (typeof this.f?.highWaterMark === "number" && this.b.data.length > this.f.highWaterMark) {
            return new Promise((resolve4) => this.d.push(resolve4));
          }
        }
      }
      error(error) {
        if (this.a.destroyed) {
          return;
        }
        if (this.a.flowing) {
          this.h(error);
        } else {
          this.b.error.push(error);
        }
      }
      end(result) {
        if (this.a.destroyed) {
          return;
        }
        if (typeof result !== "undefined") {
          this.write(result);
        }
        if (this.a.flowing) {
          this.i();
          this.destroy();
        } else {
          this.a.ended = true;
        }
      }
      g(data) {
        this.c.data.slice(0).forEach((listener) => listener(data));
      }
      h(error) {
        if (this.c.error.length === 0) {
          $gb(error);
        } else {
          this.c.error.slice(0).forEach((listener) => listener(error));
        }
      }
      i() {
        this.c.end.slice(0).forEach((listener) => listener());
      }
      on(event, callback) {
        if (this.a.destroyed) {
          return;
        }
        switch (event) {
          case "data":
            this.c.data.push(callback);
            this.resume();
            break;
          case "end":
            this.c.end.push(callback);
            if (this.a.flowing && this.l()) {
              this.destroy();
            }
            break;
          case "error":
            this.c.error.push(callback);
            if (this.a.flowing) {
              this.k();
            }
            break;
        }
      }
      removeListener(event, callback) {
        if (this.a.destroyed) {
          return;
        }
        let listeners = void 0;
        switch (event) {
          case "data":
            listeners = this.c.data;
            break;
          case "end":
            listeners = this.c.end;
            break;
          case "error":
            listeners = this.c.error;
            break;
        }
        if (listeners) {
          const index = listeners.indexOf(callback);
          if (index >= 0) {
            listeners.splice(index, 1);
          }
        }
      }
      j() {
        if (this.b.data.length > 0) {
          const fullDataBuffer = this.e(this.b.data);
          this.g(fullDataBuffer);
          this.b.data.length = 0;
          const pendingWritePromises = [...this.d];
          this.d.length = 0;
          pendingWritePromises.forEach((pendingWritePromise) => pendingWritePromise());
        }
      }
      k() {
        if (this.c.error.length > 0) {
          for (const error of this.b.error) {
            this.h(error);
          }
          this.b.error.length = 0;
        }
      }
      l() {
        if (this.a.ended) {
          this.i();
          return this.c.end.length > 0;
        }
        return false;
      }
      destroy() {
        if (!this.a.destroyed) {
          this.a.destroyed = true;
          this.a.ended = true;
          this.b.data.length = 0;
          this.b.error.length = 0;
          this.c.data.length = 0;
          this.c.error.length = 0;
          this.c.end.length = 0;
          this.d.length = 0;
        }
      }
    };
  }
});

// out-build/vs/base/common/buffer.js
function $Di(haystack, needle, offset = 0) {
  const needleLen = needle.byteLength;
  const haystackLen = haystack.byteLength;
  if (needleLen === 0) {
    return 0;
  }
  if (needleLen === 1) {
    return haystack.indexOf(needle[0]);
  }
  if (needleLen > haystackLen - offset) {
    return -1;
  }
  const table = indexOfTable.value;
  table.fill(needle.length);
  for (let i2 = 0; i2 < needle.length; i2++) {
    table[needle[i2]] = needle.length - i2 - 1;
  }
  let i = offset + needle.length - 1;
  let j = i;
  let result = -1;
  while (i < haystackLen) {
    if (haystack[i] === needle[j]) {
      if (j === 0) {
        result = i;
        break;
      }
      i--;
      j--;
    } else {
      i += Math.max(needle.length - j, table[haystack[i]]);
      j = needle.length - 1;
    }
  }
  return result;
}
function $Gi(source, offset) {
  return source[offset] * 2 ** 24 + source[offset + 1] * 2 ** 16 + source[offset + 2] * 2 ** 8 + source[offset + 3];
}
function $Hi(destination, value, offset) {
  destination[offset + 3] = value;
  value = value >>> 8;
  destination[offset + 2] = value;
  value = value >>> 8;
  destination[offset + 1] = value;
  value = value >>> 8;
  destination[offset] = value;
}
function $Ii(source, offset) {
  return source[offset + 0] << 0 >>> 0 | source[offset + 1] << 8 >>> 0 | source[offset + 2] << 16 >>> 0 | source[offset + 3] << 24 >>> 0;
}
function $Ji(destination, value, offset) {
  destination[offset + 0] = value & 255;
  value = value >>> 8;
  destination[offset + 1] = value & 255;
  value = value >>> 8;
  destination[offset + 2] = value & 255;
  value = value >>> 8;
  destination[offset + 3] = value & 255;
}
function $Ki(source, offset) {
  return source[offset];
}
function $Li(destination, value, offset) {
  destination[offset] = value;
}
function $Mi(readable) {
  return $ri(readable, (chunks) => $Ci.concat(chunks));
}
function $Ni(buffer) {
  return $yi(buffer);
}
function $Oi(stream) {
  return $ti(stream, (chunks) => $Ci.concat(chunks));
}
async function $Pi(bufferedStream) {
  if (bufferedStream.ended) {
    return $Ci.concat(bufferedStream.buffer);
  }
  return $Ci.concat([
    // Include already read chunks...
    ...bufferedStream.buffer,
    // ...and all additional chunks
    await $Oi(bufferedStream.stream)
  ]);
}
function $Ri(stream) {
  return $zi(stream, { data: (data) => typeof data === "string" ? $Ci.fromString(data) : $Ci.wrap(data) }, (chunks) => $Ci.concat(chunks));
}
function $Si(options2) {
  return $qi((chunks) => $Ci.concat(chunks), options2);
}
function $Vi(encoded) {
  let building = 0;
  let remainder = 0;
  let bufi = 0;
  const buffer = new Uint8Array(Math.floor(encoded.length / 4 * 3));
  const append = (value) => {
    switch (remainder) {
      case 3:
        buffer[bufi++] = building | value;
        remainder = 0;
        break;
      case 2:
        buffer[bufi++] = building | value >>> 2;
        building = value << 6;
        remainder = 3;
        break;
      case 1:
        buffer[bufi++] = building | value >>> 4;
        building = value << 4;
        remainder = 2;
        break;
      default:
        building = value << 2;
        remainder = 1;
    }
  };
  for (let i = 0; i < encoded.length; i++) {
    const code = encoded.charCodeAt(i);
    if (code >= 65 && code <= 90) {
      append(code - 65);
    } else if (code >= 97 && code <= 122) {
      append(code - 97 + 26);
    } else if (code >= 48 && code <= 57) {
      append(code - 48 + 52);
    } else if (code === 43 || code === 45) {
      append(62);
    } else if (code === 47 || code === 95) {
      append(63);
    } else if (code === 61) {
      break;
    } else {
      throw new SyntaxError(`Unexpected base64 character ${encoded[i]}`);
    }
  }
  const unpadded = bufi;
  while (remainder > 0) {
    append(0);
  }
  return $Ci.wrap(buffer).slice(0, unpadded);
}
function $Wi({ buffer }, padded = true, urlSafe = false) {
  const dictionary = urlSafe ? base64UrlSafeAlphabet : base64Alphabet;
  let output = "";
  const remainder = buffer.byteLength % 3;
  let i = 0;
  for (; i < buffer.byteLength - remainder; i += 3) {
    const a = buffer[i + 0];
    const b = buffer[i + 1];
    const c = buffer[i + 2];
    output += dictionary[a >>> 2];
    output += dictionary[(a << 4 | b >>> 4) & 63];
    output += dictionary[(b << 2 | c >>> 6) & 63];
    output += dictionary[c & 63];
  }
  if (remainder === 1) {
    const a = buffer[i + 0];
    output += dictionary[a >>> 2];
    output += dictionary[a << 4 & 63];
    if (padded) {
      output += "==";
    }
  } else if (remainder === 2) {
    const a = buffer[i + 0];
    const b = buffer[i + 1];
    output += dictionary[a >>> 2];
    output += dictionary[(a << 4 | b >>> 4) & 63];
    output += dictionary[b << 2 & 63];
    if (padded) {
      output += "=";
    }
  }
  return output;
}
var hasBuffer, indexOfTable, textEncoder, textDecoder, $Ci, base64Alphabet, base64UrlSafeAlphabet;
var init_buffer = __esm({
  "out-build/vs/base/common/buffer.js"() {
    "use strict";
    init_lazy();
    init_stream();
    hasBuffer = typeof Buffer !== "undefined";
    indexOfTable = new $sf(() => new Uint8Array(256));
    $Ci = class _$Ci {
      /**
       * When running in a nodejs context, the backing store for the returned `VSBuffer` instance
       * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.
       */
      static alloc(byteLength) {
        if (hasBuffer) {
          return new _$Ci(Buffer.allocUnsafe(byteLength));
        } else {
          return new _$Ci(new Uint8Array(byteLength));
        }
      }
      /**
       * When running in a nodejs context, if `actual` is not a nodejs Buffer, the backing store for
       * the returned `VSBuffer` instance might use a nodejs Buffer allocated from node's Buffer pool,
       * which is not transferrable.
       */
      static wrap(actual) {
        if (hasBuffer && !Buffer.isBuffer(actual)) {
          actual = Buffer.from(actual.buffer, actual.byteOffset, actual.byteLength);
        }
        return new _$Ci(actual);
      }
      /**
       * When running in a nodejs context, the backing store for the returned `VSBuffer` instance
       * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.
       */
      static fromString(source, options2) {
        const dontUseNodeBuffer = options2?.dontUseNodeBuffer || false;
        if (!dontUseNodeBuffer && hasBuffer) {
          return new _$Ci(Buffer.from(source));
        } else {
          if (!textEncoder) {
            textEncoder = new TextEncoder();
          }
          return new _$Ci(textEncoder.encode(source));
        }
      }
      /**
       * When running in a nodejs context, the backing store for the returned `VSBuffer` instance
       * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.
       */
      static fromByteArray(source) {
        const result = _$Ci.alloc(source.length);
        for (let i = 0, len = source.length; i < len; i++) {
          result.buffer[i] = source[i];
        }
        return result;
      }
      /**
       * When running in a nodejs context, the backing store for the returned `VSBuffer` instance
       * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.
       */
      static concat(buffers, totalLength) {
        if (typeof totalLength === "undefined") {
          totalLength = 0;
          for (let i = 0, len = buffers.length; i < len; i++) {
            totalLength += buffers[i].byteLength;
          }
        }
        const ret = _$Ci.alloc(totalLength);
        let offset = 0;
        for (let i = 0, len = buffers.length; i < len; i++) {
          const element = buffers[i];
          ret.set(element, offset);
          offset += element.byteLength;
        }
        return ret;
      }
      constructor(buffer) {
        this.buffer = buffer;
        this.byteLength = this.buffer.byteLength;
      }
      /**
       * When running in a nodejs context, the backing store for the returned `VSBuffer` instance
       * might use a nodejs Buffer allocated from node's Buffer pool, which is not transferrable.
       */
      clone() {
        const result = _$Ci.alloc(this.byteLength);
        result.set(this);
        return result;
      }
      toString() {
        if (hasBuffer) {
          return this.buffer.toString();
        } else {
          if (!textDecoder) {
            textDecoder = new TextDecoder();
          }
          return textDecoder.decode(this.buffer);
        }
      }
      slice(start, end) {
        return new _$Ci(this.buffer.subarray(start, end));
      }
      set(array, offset) {
        if (array instanceof _$Ci) {
          this.buffer.set(array.buffer, offset);
        } else if (array instanceof Uint8Array) {
          this.buffer.set(array, offset);
        } else if (array instanceof ArrayBuffer) {
          this.buffer.set(new Uint8Array(array), offset);
        } else if (ArrayBuffer.isView(array)) {
          this.buffer.set(new Uint8Array(array.buffer, array.byteOffset, array.byteLength), offset);
        } else {
          throw new Error(`Unknown argument 'array'`);
        }
      }
      readUInt32BE(offset) {
        return $Gi(this.buffer, offset);
      }
      writeUInt32BE(value, offset) {
        $Hi(this.buffer, value, offset);
      }
      readUInt32LE(offset) {
        return $Ii(this.buffer, offset);
      }
      writeUInt32LE(value, offset) {
        $Ji(this.buffer, value, offset);
      }
      readUInt8(offset) {
        return $Ki(this.buffer, offset);
      }
      writeUInt8(value, offset) {
        $Li(this.buffer, value, offset);
      }
      indexOf(subarray, offset = 0) {
        return $Di(this.buffer, subarray instanceof _$Ci ? subarray.buffer : subarray, offset);
      }
    };
    base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    base64UrlSafeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
  }
});

// out-build/vs/base/common/hash.js
function $Xi(obj) {
  return $Yi(obj, 0);
}
function $Yi(obj, hashVal) {
  switch (typeof obj) {
    case "object":
      if (obj === null) {
        return $Zi(349, hashVal);
      } else if (Array.isArray(obj)) {
        return arrayHash(obj, hashVal);
      }
      return objectHash(obj, hashVal);
    case "string":
      return $1i(obj, hashVal);
    case "boolean":
      return booleanHash(obj, hashVal);
    case "number":
      return $Zi(obj, hashVal);
    case "undefined":
      return $Zi(937, hashVal);
    default:
      return $Zi(617, hashVal);
  }
}
function $Zi(val, initialHashVal) {
  return (initialHashVal << 5) - initialHashVal + val | 0;
}
function booleanHash(b, initialHashVal) {
  return $Zi(b ? 433 : 863, initialHashVal);
}
function $1i(s, hashVal) {
  hashVal = $Zi(149417, hashVal);
  for (let i = 0, length = s.length; i < length; i++) {
    hashVal = $Zi(s.charCodeAt(i), hashVal);
  }
  return hashVal;
}
function arrayHash(arr, initialHashVal) {
  initialHashVal = $Zi(104579, initialHashVal);
  return arr.reduce((hashVal, item) => $Yi(item, hashVal), initialHashVal);
}
function objectHash(obj, initialHashVal) {
  initialHashVal = $Zi(181387, initialHashVal);
  return Object.keys(obj).sort().reduce((hashVal, key) => {
    hashVal = $1i(key, hashVal);
    return $Yi(obj[key], hashVal);
  }, initialHashVal);
}
function leftRotate(value, bits, totalBits = 32) {
  const delta = totalBits - bits;
  const mask = ~((1 << delta) - 1);
  return (value << bits | (mask & value) >>> delta) >>> 0;
}
function toHexString(bufferOrValue, bitsize = 32) {
  if (bufferOrValue instanceof ArrayBuffer) {
    return Array.from(new Uint8Array(bufferOrValue)).map((b) => b.toString(16).padStart(2, "0")).join("");
  }
  return (bufferOrValue >>> 0).toString(16).padStart(bitsize / 4, "0");
}
var SHA1Constant, $3i;
var init_hash = __esm({
  "out-build/vs/base/common/hash.js"() {
    "use strict";
    init_buffer();
    init_strings();
    (function(SHA1Constant2) {
      SHA1Constant2[SHA1Constant2["BLOCK_SIZE"] = 64] = "BLOCK_SIZE";
      SHA1Constant2[SHA1Constant2["UNICODE_REPLACEMENT"] = 65533] = "UNICODE_REPLACEMENT";
    })(SHA1Constant || (SHA1Constant = {}));
    $3i = class _$3i {
      static {
        this.g = new DataView(new ArrayBuffer(320));
      }
      // 80 * 4 = 320
      constructor() {
        this.h = 1732584193;
        this.l = 4023233417;
        this.m = 2562383102;
        this.n = 271733878;
        this.o = 3285377520;
        this.p = new Uint8Array(
          64 + 3
          /* to fit any utf-8 */
        );
        this.q = new DataView(this.p.buffer);
        this.r = 0;
        this.t = 0;
        this.u = 0;
        this.v = false;
      }
      update(str) {
        const strLen = str.length;
        if (strLen === 0) {
          return;
        }
        const buff = this.p;
        let buffLen = this.r;
        let leftoverHighSurrogate = this.u;
        let charCode;
        let offset;
        if (leftoverHighSurrogate !== 0) {
          charCode = leftoverHighSurrogate;
          offset = -1;
          leftoverHighSurrogate = 0;
        } else {
          charCode = str.charCodeAt(0);
          offset = 0;
        }
        while (true) {
          let codePoint = charCode;
          if ($5f(charCode)) {
            if (offset + 1 < strLen) {
              const nextCharCode = str.charCodeAt(offset + 1);
              if ($6f(nextCharCode)) {
                offset++;
                codePoint = $7f(charCode, nextCharCode);
              } else {
                codePoint = 65533;
              }
            } else {
              leftoverHighSurrogate = charCode;
              break;
            }
          } else if ($6f(charCode)) {
            codePoint = 65533;
          }
          buffLen = this.w(buff, buffLen, codePoint);
          offset++;
          if (offset < strLen) {
            charCode = str.charCodeAt(offset);
          } else {
            break;
          }
        }
        this.r = buffLen;
        this.u = leftoverHighSurrogate;
      }
      w(buff, buffLen, codePoint) {
        if (codePoint < 128) {
          buff[buffLen++] = codePoint;
        } else if (codePoint < 2048) {
          buff[buffLen++] = 192 | (codePoint & 1984) >>> 6;
          buff[buffLen++] = 128 | (codePoint & 63) >>> 0;
        } else if (codePoint < 65536) {
          buff[buffLen++] = 224 | (codePoint & 61440) >>> 12;
          buff[buffLen++] = 128 | (codePoint & 4032) >>> 6;
          buff[buffLen++] = 128 | (codePoint & 63) >>> 0;
        } else {
          buff[buffLen++] = 240 | (codePoint & 1835008) >>> 18;
          buff[buffLen++] = 128 | (codePoint & 258048) >>> 12;
          buff[buffLen++] = 128 | (codePoint & 4032) >>> 6;
          buff[buffLen++] = 128 | (codePoint & 63) >>> 0;
        }
        if (buffLen >= 64) {
          this.y();
          buffLen -= 64;
          this.t += 64;
          buff[0] = buff[64 + 0];
          buff[1] = buff[64 + 1];
          buff[2] = buff[64 + 2];
        }
        return buffLen;
      }
      digest() {
        if (!this.v) {
          this.v = true;
          if (this.u) {
            this.u = 0;
            this.r = this.w(
              this.p,
              this.r,
              65533
              /* SHA1Constant.UNICODE_REPLACEMENT */
            );
          }
          this.t += this.r;
          this.x();
        }
        return toHexString(this.h) + toHexString(this.l) + toHexString(this.m) + toHexString(this.n) + toHexString(this.o);
      }
      x() {
        this.p[this.r++] = 128;
        this.p.subarray(this.r).fill(0);
        if (this.r > 56) {
          this.y();
          this.p.fill(0);
        }
        const ml = 8 * this.t;
        this.q.setUint32(56, Math.floor(ml / 4294967296), false);
        this.q.setUint32(60, ml % 4294967296, false);
        this.y();
      }
      y() {
        const bigBlock32 = _$3i.g;
        const data = this.q;
        for (let j = 0; j < 64; j += 4) {
          bigBlock32.setUint32(j, data.getUint32(j, false), false);
        }
        for (let j = 64; j < 320; j += 4) {
          bigBlock32.setUint32(j, leftRotate(bigBlock32.getUint32(j - 12, false) ^ bigBlock32.getUint32(j - 32, false) ^ bigBlock32.getUint32(j - 56, false) ^ bigBlock32.getUint32(j - 64, false), 1), false);
        }
        let a = this.h;
        let b = this.l;
        let c = this.m;
        let d = this.n;
        let e = this.o;
        let f, k;
        let temp;
        for (let j = 0; j < 80; j++) {
          if (j < 20) {
            f = b & c | ~b & d;
            k = 1518500249;
          } else if (j < 40) {
            f = b ^ c ^ d;
            k = 1859775393;
          } else if (j < 60) {
            f = b & c | b & d | c & d;
            k = 2400959708;
          } else {
            f = b ^ c ^ d;
            k = 3395469782;
          }
          temp = leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false) & 4294967295;
          e = d;
          d = c;
          c = leftRotate(b, 30);
          b = a;
          a = temp;
        }
        this.h = this.h + a & 4294967295;
        this.l = this.l + b & 4294967295;
        this.m = this.m + c & 4294967295;
        this.n = this.n + d & 4294967295;
        this.o = this.o + e & 4294967295;
      }
    };
  }
});

// out-build/vs/base/common/extpath.js
function $Sg(code) {
  return code === 47 || code === 92;
}
function $Tg(osPath) {
  return osPath.replace(/[\\/]/g, $kc.sep);
}
function $Ug(osPath) {
  if (osPath.indexOf("/") === -1) {
    osPath = $Tg(osPath);
  }
  if (/^[a-zA-Z]:(\/|$)/.test(osPath)) {
    osPath = "/" + osPath;
  }
  return osPath;
}
function $Vg(path7, sep2 = $kc.sep) {
  if (!path7) {
    return "";
  }
  const len = path7.length;
  const firstLetter = path7.charCodeAt(0);
  if ($Sg(firstLetter)) {
    if ($Sg(path7.charCodeAt(1))) {
      if (!$Sg(path7.charCodeAt(2))) {
        let pos2 = 3;
        const start = pos2;
        for (; pos2 < len; pos2++) {
          if ($Sg(path7.charCodeAt(pos2))) {
            break;
          }
        }
        if (start !== pos2 && !$Sg(path7.charCodeAt(pos2 + 1))) {
          pos2 += 1;
          for (; pos2 < len; pos2++) {
            if ($Sg(path7.charCodeAt(pos2))) {
              return path7.slice(0, pos2 + 1).replace(/[\\/]/g, sep2);
            }
          }
        }
      }
    }
    return sep2;
  } else if ($1g(firstLetter)) {
    if (path7.charCodeAt(1) === 58) {
      if ($Sg(path7.charCodeAt(2))) {
        return path7.slice(0, 2) + sep2;
      } else {
        return path7.slice(0, 2);
      }
    }
  }
  let pos = path7.indexOf("://");
  if (pos !== -1) {
    pos += 3;
    for (; pos < len; pos++) {
      if ($Sg(path7.charCodeAt(pos))) {
        return path7.slice(0, pos + 1);
      }
    }
  }
  return "";
}
function $Yg(pathA, pathB, ignoreCase) {
  const identityEquals = pathA === pathB;
  if (!ignoreCase || identityEquals) {
    return identityEquals;
  }
  if (!pathA || !pathB) {
    return false;
  }
  return $1f(pathA, pathB);
}
function $Zg(base, parentCandidate, ignoreCase, separator = sep) {
  if (base === parentCandidate) {
    return true;
  }
  if (!base || !parentCandidate) {
    return false;
  }
  if (parentCandidate.length > base.length) {
    return false;
  }
  if (ignoreCase) {
    const beginsWith = $2f(base, parentCandidate);
    if (!beginsWith) {
      return false;
    }
    if (parentCandidate.length === base.length) {
      return true;
    }
    let sepOffset = parentCandidate.length;
    if (parentCandidate.charAt(parentCandidate.length - 1) === separator) {
      sepOffset--;
    }
    return base.charAt(sepOffset) === separator;
  }
  if (parentCandidate.charAt(parentCandidate.length - 1) !== separator) {
    parentCandidate += separator;
  }
  return base.indexOf(parentCandidate) === 0;
}
function $1g(char0) {
  return char0 >= 65 && char0 <= 90 || char0 >= 97 && char0 <= 122;
}
function $3g(candidate) {
  if ($l) {
    candidate = $Gf(candidate, sep);
    if (candidate.endsWith(":")) {
      candidate += sep;
    }
  } else {
    candidate = $Gf(candidate, sep);
    if (!candidate) {
      candidate = sep;
    }
  }
  return candidate;
}
function $4g(path7) {
  const pathNormalized = $lc(path7);
  if ($l) {
    if (path7.length > 3) {
      return false;
    }
    return $5g(pathNormalized) && (path7.length === 2 || pathNormalized.charCodeAt(2) === 92);
  }
  return pathNormalized === $kc.sep;
}
function $5g(path7, isWindowsOS = $l) {
  if (isWindowsOS) {
    return $1g(path7.charCodeAt(0)) && path7.charCodeAt(1) === 58;
  }
  return false;
}
function $9g(parent, prefix, randomLength = 8) {
  let suffix = "";
  for (let i = 0; i < randomLength; i++) {
    let pathCharsTouse;
    if (i === 0 && $l && !prefix && (randomLength === 3 || randomLength === 4)) {
      pathCharsTouse = windowsSafePathFirstChars;
    } else {
      pathCharsTouse = pathChars;
    }
    suffix += pathCharsTouse.charAt(Math.floor(Math.random() * pathCharsTouse.length));
  }
  let randomFileName;
  if (prefix) {
    randomFileName = `${prefix}-${suffix}`;
  } else {
    randomFileName = suffix;
  }
  if (parent) {
    return $nc(parent, randomFileName);
  }
  return randomFileName;
}
var pathChars, windowsSafePathFirstChars;
var init_extpath = __esm({
  "out-build/vs/base/common/extpath.js"() {
    "use strict";
    init_path();
    init_platform();
    init_strings();
    init_types();
    pathChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    windowsSafePathFirstChars = "BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";
  }
});

// out-build/vs/base/common/resources.js
function $jh(uri) {
  return $Ac(uri, true);
}
var $kh, $lh, $mh, $nh, $oh, $ph, $qh, $rh, $sh, $th, $uh, $vh, $wh, $xh, $yh, $zh, $Ah, $Bh, $Ch, $Dh, DataUri;
var init_resources = __esm({
  "out-build/vs/base/common/resources.js"() {
    "use strict";
    init_extpath();
    init_network();
    init_path();
    init_platform();
    init_strings();
    init_uri();
    $kh = class {
      constructor(a) {
        this.a = a;
      }
      compare(uri1, uri2, ignoreFragment = false) {
        if (uri1 === uri2) {
          return 0;
        }
        return $Tf(this.getComparisonKey(uri1, ignoreFragment), this.getComparisonKey(uri2, ignoreFragment));
      }
      isEqual(uri1, uri2, ignoreFragment = false) {
        if (uri1 === uri2) {
          return true;
        }
        if (!uri1 || !uri2) {
          return false;
        }
        return this.getComparisonKey(uri1, ignoreFragment) === this.getComparisonKey(uri2, ignoreFragment);
      }
      getComparisonKey(uri, ignoreFragment = false) {
        return uri.with({
          path: this.a(uri) ? uri.path.toLowerCase() : void 0,
          fragment: ignoreFragment ? null : void 0
        }).toString();
      }
      ignorePathCasing(uri) {
        return this.a(uri);
      }
      isEqualOrParent(base, parentCandidate, ignoreFragment = false) {
        if (base.scheme === parentCandidate.scheme) {
          if (base.scheme === Schemas.file) {
            return $Zg($jh(base), $jh(parentCandidate), this.a(base)) && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);
          }
          if ($Ah(base.authority, parentCandidate.authority)) {
            return $Zg(base.path, parentCandidate.path, this.a(base), "/") && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);
          }
        }
        return false;
      }
      // --- path math
      joinPath(resource, ...pathFragment) {
        return URI.joinPath(resource, ...pathFragment);
      }
      basenameOrAuthority(resource) {
        return $sh(resource) || resource.authority;
      }
      basename(resource) {
        return $kc.basename(resource.path);
      }
      extname(resource) {
        return $kc.extname(resource.path);
      }
      dirname(resource) {
        if (resource.path.length === 0) {
          return resource;
        }
        let dirname5;
        if (resource.scheme === Schemas.file) {
          dirname5 = URI.file($qc($jh(resource))).path;
        } else {
          dirname5 = $kc.dirname(resource.path);
          if (resource.authority && dirname5.length && dirname5.charCodeAt(0) !== 47) {
            console.error(`dirname("${resource.toString})) resulted in a relative path`);
            dirname5 = "/";
          }
        }
        return resource.with({
          path: dirname5
        });
      }
      normalizePath(resource) {
        if (!resource.path.length) {
          return resource;
        }
        let normalizedPath;
        if (resource.scheme === Schemas.file) {
          normalizedPath = URI.file($lc($jh(resource))).path;
        } else {
          normalizedPath = $kc.normalize(resource.path);
        }
        return resource.with({
          path: normalizedPath
        });
      }
      relativePath(from, to) {
        if (from.scheme !== to.scheme || !$Ah(from.authority, to.authority)) {
          return void 0;
        }
        if (from.scheme === Schemas.file) {
          const relativePath = $pc($jh(from), $jh(to));
          return $l ? $Tg(relativePath) : relativePath;
        }
        let fromPath = from.path || "/";
        const toPath = to.path || "/";
        if (this.a(from)) {
          let i = 0;
          for (const len = Math.min(fromPath.length, toPath.length); i < len; i++) {
            if (fromPath.charCodeAt(i) !== toPath.charCodeAt(i)) {
              if (fromPath.charAt(i).toLowerCase() !== toPath.charAt(i).toLowerCase()) {
                break;
              }
            }
          }
          fromPath = toPath.substr(0, i) + fromPath.substr(i);
        }
        return $kc.relative(fromPath, toPath);
      }
      resolvePath(base, path7) {
        if (base.scheme === Schemas.file) {
          const newURI = URI.file($oc($jh(base), path7));
          return base.with({
            authority: newURI.authority,
            path: newURI.path
          });
        }
        path7 = $Ug(path7);
        return base.with({
          path: $kc.resolve(base.path, path7)
        });
      }
      // --- misc
      isAbsolutePath(resource) {
        return !!resource.path && resource.path[0] === "/";
      }
      isEqualAuthority(a1, a2) {
        return a1 === a2 || a1 !== void 0 && a2 !== void 0 && $1f(a1, a2);
      }
      hasTrailingPathSeparator(resource, sep2 = sep) {
        if (resource.scheme === Schemas.file) {
          const fsp = $jh(resource);
          return fsp.length > $Vg(fsp).length && fsp[fsp.length - 1] === sep2;
        } else {
          const p = resource.path;
          return p.length > 1 && p.charCodeAt(p.length - 1) === 47 && !/^[a-zA-Z]:(\/$|\\$)/.test(resource.fsPath);
        }
      }
      removeTrailingPathSeparator(resource, sep2 = sep) {
        if ($Bh(resource, sep2)) {
          return resource.with({ path: resource.path.substr(0, resource.path.length - 1) });
        }
        return resource;
      }
      addTrailingPathSeparator(resource, sep2 = sep) {
        let isRootSep = false;
        if (resource.scheme === Schemas.file) {
          const fsp = $jh(resource);
          isRootSep = fsp !== void 0 && fsp.length === $Vg(fsp).length && fsp[fsp.length - 1] === sep2;
        } else {
          sep2 = "/";
          const p = resource.path;
          isRootSep = p.length === 1 && p.charCodeAt(p.length - 1) === 47;
        }
        if (!isRootSep && !$Bh(resource, sep2)) {
          return resource.with({ path: resource.path + "/" });
        }
        return resource;
      }
    };
    $lh = new $kh(() => false);
    $mh = new $kh((uri) => {
      return uri.scheme === Schemas.file ? !$n : true;
    });
    $nh = new $kh((_) => true);
    $oh = $lh.isEqual.bind($lh);
    $ph = $lh.isEqualOrParent.bind($lh);
    $qh = $lh.getComparisonKey.bind($lh);
    $rh = $lh.basenameOrAuthority.bind($lh);
    $sh = $lh.basename.bind($lh);
    $th = $lh.extname.bind($lh);
    $uh = $lh.dirname.bind($lh);
    $vh = $lh.joinPath.bind($lh);
    $wh = $lh.normalizePath.bind($lh);
    $xh = $lh.relativePath.bind($lh);
    $yh = $lh.resolvePath.bind($lh);
    $zh = $lh.isAbsolutePath.bind($lh);
    $Ah = $lh.isEqualAuthority.bind($lh);
    $Bh = $lh.hasTrailingPathSeparator.bind($lh);
    $Ch = $lh.removeTrailingPathSeparator.bind($lh);
    $Dh = $lh.addTrailingPathSeparator.bind($lh);
    (function(DataUri2) {
      DataUri2.META_DATA_LABEL = "label";
      DataUri2.META_DATA_DESCRIPTION = "description";
      DataUri2.META_DATA_SIZE = "size";
      DataUri2.META_DATA_MIME = "mime";
      function parseMetaData(dataUri) {
        const metadata = /* @__PURE__ */ new Map();
        const meta = dataUri.path.substring(dataUri.path.indexOf(";") + 1, dataUri.path.lastIndexOf(";"));
        meta.split(";").forEach((property) => {
          const [key, value] = property.split(":");
          if (key && value) {
            metadata.set(key, value);
          }
        });
        const mime = dataUri.path.substring(0, dataUri.path.indexOf(";"));
        if (mime) {
          metadata.set(DataUri2.META_DATA_MIME, mime);
        }
        return metadata;
      }
      DataUri2.parseMetaData = parseMetaData;
    })(DataUri || (DataUri = {}));
  }
});

// out-build/vs/platform/contextkey/common/scanner.js
function hintDidYouMean(...meant) {
  switch (meant.length) {
    case 1:
      return localize(1724, null, meant[0]);
    case 2:
      return localize(1725, null, meant[0], meant[1]);
    case 3:
      return localize(1726, null, meant[0], meant[1], meant[2]);
    default:
      return void 0;
  }
}
var TokenType, hintDidYouForgetToOpenOrCloseQuote, hintDidYouForgetToEscapeSlash, $4m;
var init_scanner = __esm({
  "out-build/vs/platform/contextkey/common/scanner.js"() {
    "use strict";
    init_errors();
    init_nls2();
    (function(TokenType3) {
      TokenType3[TokenType3["LParen"] = 0] = "LParen";
      TokenType3[TokenType3["RParen"] = 1] = "RParen";
      TokenType3[TokenType3["Neg"] = 2] = "Neg";
      TokenType3[TokenType3["Eq"] = 3] = "Eq";
      TokenType3[TokenType3["NotEq"] = 4] = "NotEq";
      TokenType3[TokenType3["Lt"] = 5] = "Lt";
      TokenType3[TokenType3["LtEq"] = 6] = "LtEq";
      TokenType3[TokenType3["Gt"] = 7] = "Gt";
      TokenType3[TokenType3["GtEq"] = 8] = "GtEq";
      TokenType3[TokenType3["RegexOp"] = 9] = "RegexOp";
      TokenType3[TokenType3["RegexStr"] = 10] = "RegexStr";
      TokenType3[TokenType3["True"] = 11] = "True";
      TokenType3[TokenType3["False"] = 12] = "False";
      TokenType3[TokenType3["In"] = 13] = "In";
      TokenType3[TokenType3["Not"] = 14] = "Not";
      TokenType3[TokenType3["And"] = 15] = "And";
      TokenType3[TokenType3["Or"] = 16] = "Or";
      TokenType3[TokenType3["Str"] = 17] = "Str";
      TokenType3[TokenType3["QuotedStr"] = 18] = "QuotedStr";
      TokenType3[TokenType3["Error"] = 19] = "Error";
      TokenType3[TokenType3["EOF"] = 20] = "EOF";
    })(TokenType || (TokenType = {}));
    hintDidYouForgetToOpenOrCloseQuote = localize(1727, null);
    hintDidYouForgetToEscapeSlash = localize(1728, null);
    $4m = class _$4m {
      constructor() {
        this.c = "";
        this.d = 0;
        this.e = 0;
        this.f = [];
        this.g = [];
        this.m = /[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy;
      }
      static getLexeme(token) {
        switch (token.type) {
          case 0:
            return "(";
          case 1:
            return ")";
          case 2:
            return "!";
          case 3:
            return token.isTripleEq ? "===" : "==";
          case 4:
            return token.isTripleEq ? "!==" : "!=";
          case 5:
            return "<";
          case 6:
            return "<=";
          case 7:
            return ">=";
          case 8:
            return ">=";
          case 9:
            return "=~";
          case 10:
            return token.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 token.lexeme;
          case 18:
            return token.lexeme;
          case 19:
            return token.lexeme;
          case 20:
            return "EOF";
          default:
            throw $ob(`unhandled token type: ${JSON.stringify(token)}; have you forgotten to add a case?`);
        }
      }
      static {
        this.a = new Set(["i", "g", "s", "m", "y", "u"].map((ch) => ch.charCodeAt(0)));
      }
      static {
        this.b = /* @__PURE__ */ new Map([
          [
            "not",
            14
            /* TokenType.Not */
          ],
          [
            "in",
            13
            /* TokenType.In */
          ],
          [
            "false",
            12
            /* TokenType.False */
          ],
          [
            "true",
            11
            /* TokenType.True */
          ]
        ]);
      }
      get errors() {
        return this.g;
      }
      reset(value) {
        this.c = value;
        this.d = 0;
        this.e = 0;
        this.f = [];
        this.g = [];
        return this;
      }
      scan() {
        while (!this.r()) {
          this.d = this.e;
          const ch = this.i();
          switch (ch) {
            case 40:
              this.k(
                0
                /* TokenType.LParen */
              );
              break;
            case 41:
              this.k(
                1
                /* TokenType.RParen */
              );
              break;
            case 33:
              if (this.h(
                61
                /* CharCode.Equals */
              )) {
                const isTripleEq = this.h(
                  61
                  /* CharCode.Equals */
                );
                this.f.push({ type: 4, offset: this.d, isTripleEq });
              } else {
                this.k(
                  2
                  /* TokenType.Neg */
                );
              }
              break;
            case 39:
              this.o();
              break;
            case 47:
              this.q();
              break;
            case 61:
              if (this.h(
                61
                /* CharCode.Equals */
              )) {
                const isTripleEq = this.h(
                  61
                  /* CharCode.Equals */
                );
                this.f.push({ type: 3, offset: this.d, isTripleEq });
              } else if (this.h(
                126
                /* CharCode.Tilde */
              )) {
                this.k(
                  9
                  /* TokenType.RegexOp */
                );
              } else {
                this.l(hintDidYouMean("==", "=~"));
              }
              break;
            case 60:
              this.k(
                this.h(
                  61
                  /* CharCode.Equals */
                ) ? 6 : 5
                /* TokenType.Lt */
              );
              break;
            case 62:
              this.k(
                this.h(
                  61
                  /* CharCode.Equals */
                ) ? 8 : 7
                /* TokenType.Gt */
              );
              break;
            case 38:
              if (this.h(
                38
                /* CharCode.Ampersand */
              )) {
                this.k(
                  15
                  /* TokenType.And */
                );
              } else {
                this.l(hintDidYouMean("&&"));
              }
              break;
            case 124:
              if (this.h(
                124
                /* CharCode.Pipe */
              )) {
                this.k(
                  16
                  /* TokenType.Or */
                );
              } else {
                this.l(hintDidYouMean("||"));
              }
              break;
            case 32:
            case 13:
            case 9:
            case 10:
            case 160:
              break;
            default:
              this.n();
          }
        }
        this.d = this.e;
        this.k(
          20
          /* TokenType.EOF */
        );
        return Array.from(this.f);
      }
      h(expected) {
        if (this.r()) {
          return false;
        }
        if (this.c.charCodeAt(this.e) !== expected) {
          return false;
        }
        this.e++;
        return true;
      }
      i() {
        return this.c.charCodeAt(this.e++);
      }
      j() {
        return this.r() ? 0 : this.c.charCodeAt(this.e);
      }
      k(type2) {
        this.f.push({ type: type2, offset: this.d });
      }
      l(additional) {
        const offset = this.d;
        const lexeme = this.c.substring(this.d, this.e);
        const errToken = { type: 19, offset: this.d, lexeme };
        this.g.push({ offset, lexeme, additionalInfo: additional });
        this.f.push(errToken);
      }
      n() {
        this.m.lastIndex = this.d;
        const match = this.m.exec(this.c);
        if (match) {
          this.e = this.d + match[0].length;
          const lexeme = this.c.substring(this.d, this.e);
          const keyword = _$4m.b.get(lexeme);
          if (keyword) {
            this.k(keyword);
          } else {
            this.f.push({ type: 17, lexeme, offset: this.d });
          }
        }
      }
      // captures the lexeme without the leading and trailing '
      o() {
        while (this.j() !== 39 && !this.r()) {
          this.i();
        }
        if (this.r()) {
          this.l(hintDidYouForgetToOpenOrCloseQuote);
          return;
        }
        this.i();
        this.f.push({ type: 18, lexeme: this.c.substring(this.d + 1, this.e - 1), offset: this.d + 1 });
      }
      /*
       * Lexing a regex expression: /.../[igsmyu]*
       * Based on https://github.com/microsoft/TypeScript/blob/9247ef115e617805983740ba795d7a8164babf89/src/compiler/scanner.ts#L2129-L2181
       *
       * Note that we want slashes within a regex to be escaped, e.g., /file:\\/\\/\\// should match `file:///`
       */
      q() {
        let p = this.e;
        let inEscape = false;
        let inCharacterClass = false;
        while (true) {
          if (p >= this.c.length) {
            this.e = p;
            this.l(hintDidYouForgetToEscapeSlash);
            return;
          }
          const ch = this.c.charCodeAt(p);
          if (inEscape) {
            inEscape = false;
          } else if (ch === 47 && !inCharacterClass) {
            p++;
            break;
          } else if (ch === 91) {
            inCharacterClass = true;
          } else if (ch === 92) {
            inEscape = true;
          } else if (ch === 93) {
            inCharacterClass = false;
          }
          p++;
        }
        while (p < this.c.length && _$4m.a.has(this.c.charCodeAt(p))) {
          p++;
        }
        this.e = p;
        const lexeme = this.c.substring(this.d, this.e);
        this.f.push({ type: 10, lexeme, offset: this.d });
      }
      r() {
        return this.e >= this.c.length;
      }
    };
  }
});

// out-build/vs/platform/instantiation/common/instantiation.js
function storeServiceDependency(id2, target, index) {
  if (target[_util.DI_TARGET] === target) {
    target[_util.DI_DEPENDENCIES].push({ id: id2, index });
  } else {
    target[_util.DI_DEPENDENCIES] = [{ id: id2, index }];
    target[_util.DI_TARGET] = target;
  }
}
function $Qk(serviceId) {
  if (_util.serviceIds.has(serviceId)) {
    return _util.serviceIds.get(serviceId);
  }
  const id2 = function(target, key, index) {
    if (arguments.length !== 3) {
      throw new Error("@IServiceName-decorator can only be used to decorate a parameter");
    }
    storeServiceDependency(id2, target, index);
  };
  id2.toString = () => serviceId;
  _util.serviceIds.set(serviceId, id2);
  return id2;
}
function $Rk(serviceIdentifier) {
  return serviceIdentifier;
}
var _util, $Pk;
var init_instantiation = __esm({
  "out-build/vs/platform/instantiation/common/instantiation.js"() {
    "use strict";
    (function(_util2) {
      _util2.serviceIds = /* @__PURE__ */ new Map();
      _util2.DI_TARGET = "$di$target";
      _util2.DI_DEPENDENCIES = "$di$dependencies";
      function getServiceDependencies(ctor) {
        return ctor[_util2.DI_DEPENDENCIES] || [];
      }
      _util2.getServiceDependencies = getServiceDependencies;
    })(_util || (_util = {}));
    $Pk = $Qk("instantiationService");
  }
});

// out-build/vs/platform/contextkey/common/contextkey.js
function cmp(a, b) {
  return a.cmp(b);
}
function withFloatOrStr(value, callback) {
  if (typeof value === "string") {
    const n = parseFloat(value);
    if (!isNaN(n)) {
      value = n;
    }
  }
  if (typeof value === "string" || typeof value === "number") {
    return callback(value);
  }
  return $0m.INSTANCE;
}
function eliminateConstantsInArray(arr) {
  let newArr = null;
  for (let i = 0, len = arr.length; i < len; i++) {
    const newExpr = arr[i].substituteConstants();
    if (arr[i] !== newExpr) {
      if (newArr === null) {
        newArr = [];
        for (let j = 0; j < i; j++) {
          newArr[j] = arr[j];
        }
      }
    }
    if (newArr !== null) {
      newArr[i] = newExpr;
    }
  }
  if (newArr === null) {
    return arr;
  }
  return newArr;
}
function cmp1(key1, key2) {
  if (key1 < key2) {
    return -1;
  }
  if (key1 > key2) {
    return 1;
  }
  return 0;
}
function cmp2(key1, value1, key2, value2) {
  if (key1 < key2) {
    return -1;
  }
  if (key1 > key2) {
    return 1;
  }
  if (value1 < value2) {
    return -1;
  }
  if (value1 > value2) {
    return 1;
  }
  return 0;
}
function getTerminals(node) {
  if (node.type === 9) {
    return node.expr;
  }
  return [node];
}
var CONSTANT_VALUES, hasOwnProperty2, ContextKeyExprType, defaultConfig, errorEmptyString, hintEmptyString, errorNoInAfterNot, errorClosingParenthesis, errorUnexpectedToken, hintUnexpectedToken, errorUnexpectedEOF, hintUnexpectedEOF, $6m, $7m, $0m, $$m, $_m, $an, $bn, $cn, $dn, $en, $fn, $gn, $hn, $in, $jn, $kn, $ln, $mn, $nn, $on;
var init_contextkey = __esm({
  "out-build/vs/platform/contextkey/common/contextkey.js"() {
    "use strict";
    init_platform();
    init_strings();
    init_scanner();
    init_instantiation();
    init_nls2();
    init_errors();
    CONSTANT_VALUES = /* @__PURE__ */ new Map();
    CONSTANT_VALUES.set("false", false);
    CONSTANT_VALUES.set("true", true);
    CONSTANT_VALUES.set("isMac", $m);
    CONSTANT_VALUES.set("isLinux", $n);
    CONSTANT_VALUES.set("isWindows", $l);
    CONSTANT_VALUES.set("isWeb", $r);
    CONSTANT_VALUES.set("isMacNative", $m && !$r);
    CONSTANT_VALUES.set("isEdge", $K);
    CONSTANT_VALUES.set("isFirefox", $I);
    CONSTANT_VALUES.set("isChrome", $H);
    CONSTANT_VALUES.set("isSafari", $J);
    hasOwnProperty2 = Object.prototype.hasOwnProperty;
    (function(ContextKeyExprType2) {
      ContextKeyExprType2[ContextKeyExprType2["False"] = 0] = "False";
      ContextKeyExprType2[ContextKeyExprType2["True"] = 1] = "True";
      ContextKeyExprType2[ContextKeyExprType2["Defined"] = 2] = "Defined";
      ContextKeyExprType2[ContextKeyExprType2["Not"] = 3] = "Not";
      ContextKeyExprType2[ContextKeyExprType2["Equals"] = 4] = "Equals";
      ContextKeyExprType2[ContextKeyExprType2["NotEquals"] = 5] = "NotEquals";
      ContextKeyExprType2[ContextKeyExprType2["And"] = 6] = "And";
      ContextKeyExprType2[ContextKeyExprType2["Regex"] = 7] = "Regex";
      ContextKeyExprType2[ContextKeyExprType2["NotRegex"] = 8] = "NotRegex";
      ContextKeyExprType2[ContextKeyExprType2["Or"] = 9] = "Or";
      ContextKeyExprType2[ContextKeyExprType2["In"] = 10] = "In";
      ContextKeyExprType2[ContextKeyExprType2["NotIn"] = 11] = "NotIn";
      ContextKeyExprType2[ContextKeyExprType2["Greater"] = 12] = "Greater";
      ContextKeyExprType2[ContextKeyExprType2["GreaterEquals"] = 13] = "GreaterEquals";
      ContextKeyExprType2[ContextKeyExprType2["Smaller"] = 14] = "Smaller";
      ContextKeyExprType2[ContextKeyExprType2["SmallerEquals"] = 15] = "SmallerEquals";
    })(ContextKeyExprType || (ContextKeyExprType = {}));
    defaultConfig = {
      regexParsingWithErrorRecovery: true
    };
    errorEmptyString = localize(1704, null);
    hintEmptyString = localize(1705, null);
    errorNoInAfterNot = localize(1706, null);
    errorClosingParenthesis = localize(1707, null);
    errorUnexpectedToken = localize(1708, null);
    hintUnexpectedToken = localize(1709, null);
    errorUnexpectedEOF = localize(1710, null);
    hintUnexpectedEOF = localize(1711, null);
    $6m = class _$6m {
      static {
        this.c = new Error();
      }
      get lexingErrors() {
        return this.d.errors;
      }
      get parsingErrors() {
        return this.h;
      }
      constructor(k = defaultConfig) {
        this.k = k;
        this.d = new $4m();
        this.f = [];
        this.g = 0;
        this.h = [];
        this.v = /g|y/g;
      }
      /**
       * Parse a context key expression.
       *
       * @param input the expression to parse
       * @returns the parsed expression or `undefined` if there's an error - call `lexingErrors` and `parsingErrors` to see the errors
       */
      parse(input) {
        if (input === "") {
          this.h.push({ message: errorEmptyString, offset: 0, lexeme: "", additionalInfo: hintEmptyString });
          return void 0;
        }
        this.f = this.d.reset(input).scan();
        this.g = 0;
        this.h = [];
        try {
          const expr = this.l();
          if (!this.E()) {
            const peek = this.D();
            const additionalInfo = peek.type === 17 ? hintUnexpectedToken : void 0;
            this.h.push({ message: errorUnexpectedToken, offset: peek.offset, lexeme: $4m.getLexeme(peek), additionalInfo });
            throw _$6m.c;
          }
          return expr;
        } catch (e) {
          if (!(e === _$6m.c)) {
            throw e;
          }
          return void 0;
        }
      }
      l() {
        return this.m();
      }
      m() {
        const expr = [this.o()];
        while (this.y(
          16
          /* TokenType.Or */
        )) {
          const right = this.o();
          expr.push(right);
        }
        return expr.length === 1 ? expr[0] : $7m.or(...expr);
      }
      o() {
        const expr = [this.s()];
        while (this.y(
          15
          /* TokenType.And */
        )) {
          const right = this.s();
          expr.push(right);
        }
        return expr.length === 1 ? expr[0] : $7m.and(...expr);
      }
      s() {
        if (this.y(
          2
          /* TokenType.Neg */
        )) {
          const peek = this.D();
          switch (peek.type) {
            case 11:
              this.z();
              return $0m.INSTANCE;
            case 12:
              this.z();
              return $$m.INSTANCE;
            case 0: {
              this.z();
              const expr = this.l();
              this.A(1, errorClosingParenthesis);
              return expr?.negate();
            }
            case 17:
              this.z();
              return $en.create(peek.lexeme);
            default:
              throw this.B(`KEY | true | false | '(' expression ')'`, peek);
          }
        }
        return this.t();
      }
      t() {
        const peek = this.D();
        switch (peek.type) {
          case 11:
            this.z();
            return $7m.true();
          case 12:
            this.z();
            return $7m.false();
          case 0: {
            this.z();
            const expr = this.l();
            this.A(1, errorClosingParenthesis);
            return expr;
          }
          case 17: {
            const key = peek.lexeme;
            this.z();
            if (this.y(
              9
              /* TokenType.RegexOp */
            )) {
              const expr = this.D();
              if (!this.k.regexParsingWithErrorRecovery) {
                this.z();
                if (expr.type !== 10) {
                  throw this.B(`REGEX`, expr);
                }
                const regexLexeme = expr.lexeme;
                const closingSlashIndex = regexLexeme.lastIndexOf("/");
                const flags = closingSlashIndex === regexLexeme.length - 1 ? void 0 : this.w(regexLexeme.substring(closingSlashIndex + 1));
                let regexp;
                try {
                  regexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);
                } catch (e) {
                  throw this.B(`REGEX`, expr);
                }
                return $jn.create(key, regexp);
              }
              switch (expr.type) {
                case 10:
                case 19: {
                  const lexemeReconstruction = [expr.lexeme];
                  this.z();
                  let followingToken = this.D();
                  let parenBalance = 0;
                  for (let i = 0; i < expr.lexeme.length; i++) {
                    if (expr.lexeme.charCodeAt(i) === 40) {
                      parenBalance++;
                    } else if (expr.lexeme.charCodeAt(i) === 41) {
                      parenBalance--;
                    }
                  }
                  while (!this.E() && followingToken.type !== 15 && followingToken.type !== 16) {
                    switch (followingToken.type) {
                      case 0:
                        parenBalance++;
                        break;
                      case 1:
                        parenBalance--;
                        break;
                      case 10:
                      case 18:
                        for (let i = 0; i < followingToken.lexeme.length; i++) {
                          if (followingToken.lexeme.charCodeAt(i) === 40) {
                            parenBalance++;
                          } else if (expr.lexeme.charCodeAt(i) === 41) {
                            parenBalance--;
                          }
                        }
                    }
                    if (parenBalance < 0) {
                      break;
                    }
                    lexemeReconstruction.push($4m.getLexeme(followingToken));
                    this.z();
                    followingToken = this.D();
                  }
                  const regexLexeme = lexemeReconstruction.join("");
                  const closingSlashIndex = regexLexeme.lastIndexOf("/");
                  const flags = closingSlashIndex === regexLexeme.length - 1 ? void 0 : this.w(regexLexeme.substring(closingSlashIndex + 1));
                  let regexp;
                  try {
                    regexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);
                  } catch (e) {
                    throw this.B(`REGEX`, expr);
                  }
                  return $7m.regex(key, regexp);
                }
                case 18: {
                  const serializedValue = expr.lexeme;
                  this.z();
                  let regex = null;
                  if (!$vf(serializedValue)) {
                    const start = serializedValue.indexOf("/");
                    const end = serializedValue.lastIndexOf("/");
                    if (start !== end && start >= 0) {
                      const value = serializedValue.slice(start + 1, end);
                      const caseIgnoreFlag = serializedValue[end + 1] === "i" ? "i" : "";
                      try {
                        regex = new RegExp(value, caseIgnoreFlag);
                      } catch (_e) {
                        throw this.B(`REGEX`, expr);
                      }
                    }
                  }
                  if (regex === null) {
                    throw this.B("REGEX", expr);
                  }
                  return $jn.create(key, regex);
                }
                default:
                  throw this.B("REGEX", this.D());
              }
            }
            if (this.y(
              14
              /* TokenType.Not */
            )) {
              this.A(13, errorNoInAfterNot);
              const right = this.u();
              return $7m.notIn(key, right);
            }
            const maybeOp = this.D().type;
            switch (maybeOp) {
              case 3: {
                this.z();
                const right = this.u();
                if (this.x().type === 18) {
                  return $7m.equals(key, right);
                }
                switch (right) {
                  case "true":
                    return $7m.has(key);
                  case "false":
                    return $7m.not(key);
                  default:
                    return $7m.equals(key, right);
                }
              }
              case 4: {
                this.z();
                const right = this.u();
                if (this.x().type === 18) {
                  return $7m.notEquals(key, right);
                }
                switch (right) {
                  case "true":
                    return $7m.not(key);
                  case "false":
                    return $7m.has(key);
                  default:
                    return $7m.notEquals(key, right);
                }
              }
              case 5:
                this.z();
                return $hn.create(key, this.u());
              case 6:
                this.z();
                return $in.create(key, this.u());
              case 7:
                this.z();
                return $fn.create(key, this.u());
              case 8:
                this.z();
                return $gn.create(key, this.u());
              case 13:
                this.z();
                return $7m.in(key, this.u());
              default:
                return $7m.has(key);
            }
          }
          case 20:
            this.h.push({ message: errorUnexpectedEOF, offset: peek.offset, lexeme: "", additionalInfo: hintUnexpectedEOF });
            throw _$6m.c;
          default:
            throw this.B(`true | false | KEY 
	| KEY '=~' REGEX 
	| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`, this.D());
        }
      }
      u() {
        const token = this.D();
        switch (token.type) {
          case 17:
          case 18:
            this.z();
            return token.lexeme;
          case 11:
            this.z();
            return "true";
          case 12:
            this.z();
            return "false";
          case 13:
            this.z();
            return "in";
          default:
            return "";
        }
      }
      w(flags) {
        return flags.replaceAll(this.v, "");
      }
      // careful: this can throw if current token is the initial one (ie index = 0)
      x() {
        return this.f[this.g - 1];
      }
      y(token) {
        if (this.C(token)) {
          this.z();
          return true;
        }
        return false;
      }
      z() {
        if (!this.E()) {
          this.g++;
        }
        return this.x();
      }
      A(type2, message) {
        if (this.C(type2)) {
          return this.z();
        }
        throw this.B(message, this.D());
      }
      B(expected, got, additionalInfo) {
        const message = localize(1712, null, expected, $4m.getLexeme(got));
        const offset = got.offset;
        const lexeme = $4m.getLexeme(got);
        this.h.push({ message, offset, lexeme, additionalInfo });
        return _$6m.c;
      }
      C(type2) {
        return this.D().type === type2;
      }
      D() {
        return this.f[this.g];
      }
      E() {
        return this.D().type === 20;
      }
    };
    $7m = class {
      static false() {
        return $0m.INSTANCE;
      }
      static true() {
        return $$m.INSTANCE;
      }
      static has(key) {
        return $_m.create(key);
      }
      static equals(key, value) {
        return $an.create(key, value);
      }
      static notEquals(key, value) {
        return $dn.create(key, value);
      }
      static regex(key, value) {
        return $jn.create(key, value);
      }
      static in(key, value) {
        return $bn.create(key, value);
      }
      static notIn(key, value) {
        return $cn.create(key, value);
      }
      static not(key) {
        return $en.create(key);
      }
      static and(...expr) {
        return $ln.create(expr, null, true);
      }
      static or(...expr) {
        return $mn.create(expr, null, true);
      }
      static greater(key, value) {
        return $fn.create(key, value);
      }
      static greaterEquals(key, value) {
        return $gn.create(key, value);
      }
      static smaller(key, value) {
        return $hn.create(key, value);
      }
      static smallerEquals(key, value) {
        return $in.create(key, value);
      }
      static {
        this.c = new $6m({ regexParsingWithErrorRecovery: false });
      }
      static deserialize(serialized) {
        if (serialized === void 0 || serialized === null) {
          return void 0;
        }
        const expr = this.c.parse(serialized);
        return expr;
      }
    };
    $0m = class _$0m {
      static {
        this.INSTANCE = new _$0m();
      }
      constructor() {
        this.type = 0;
      }
      cmp(other) {
        return this.type - other.type;
      }
      equals(other) {
        return other.type === this.type;
      }
      substituteConstants() {
        return this;
      }
      evaluate(context) {
        return false;
      }
      serialize() {
        return "false";
      }
      keys() {
        return [];
      }
      map(mapFnc) {
        return this;
      }
      negate() {
        return $$m.INSTANCE;
      }
    };
    $$m = class _$$m {
      static {
        this.INSTANCE = new _$$m();
      }
      constructor() {
        this.type = 1;
      }
      cmp(other) {
        return this.type - other.type;
      }
      equals(other) {
        return other.type === this.type;
      }
      substituteConstants() {
        return this;
      }
      evaluate(context) {
        return true;
      }
      serialize() {
        return "true";
      }
      keys() {
        return [];
      }
      map(mapFnc) {
        return this;
      }
      negate() {
        return $0m.INSTANCE;
      }
    };
    $_m = class _$_m {
      static create(key, negated = null) {
        const constantValue = CONSTANT_VALUES.get(key);
        if (typeof constantValue === "boolean") {
          return constantValue ? $$m.INSTANCE : $0m.INSTANCE;
        }
        return new _$_m(key, negated);
      }
      constructor(key, c) {
        this.key = key;
        this.c = c;
        this.type = 2;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return cmp1(this.key, other.key);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.key === other.key;
        }
        return false;
      }
      substituteConstants() {
        const constantValue = CONSTANT_VALUES.get(this.key);
        if (typeof constantValue === "boolean") {
          return constantValue ? $$m.INSTANCE : $0m.INSTANCE;
        }
        return this;
      }
      evaluate(context) {
        return !!context.getValue(this.key);
      }
      serialize() {
        return this.key;
      }
      keys() {
        return [this.key];
      }
      map(mapFnc) {
        return mapFnc.mapDefined(this.key);
      }
      negate() {
        if (!this.c) {
          this.c = $en.create(this.key, this);
        }
        return this.c;
      }
    };
    $an = class _$an {
      static create(key, value, negated = null) {
        if (typeof value === "boolean") {
          return value ? $_m.create(key, negated) : $en.create(key, negated);
        }
        const constantValue = CONSTANT_VALUES.get(key);
        if (typeof constantValue === "boolean") {
          const trueValue = constantValue ? "true" : "false";
          return value === trueValue ? $$m.INSTANCE : $0m.INSTANCE;
        }
        return new _$an(key, value, negated);
      }
      constructor(c, d, f) {
        this.c = c;
        this.d = d;
        this.f = f;
        this.type = 4;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return cmp2(this.c, this.d, other.c, other.d);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.c === other.c && this.d === other.d;
        }
        return false;
      }
      substituteConstants() {
        const constantValue = CONSTANT_VALUES.get(this.c);
        if (typeof constantValue === "boolean") {
          const trueValue = constantValue ? "true" : "false";
          return this.d === trueValue ? $$m.INSTANCE : $0m.INSTANCE;
        }
        return this;
      }
      evaluate(context) {
        return context.getValue(this.c) == this.d;
      }
      serialize() {
        return `${this.c} == '${this.d}'`;
      }
      keys() {
        return [this.c];
      }
      map(mapFnc) {
        return mapFnc.mapEquals(this.c, this.d);
      }
      negate() {
        if (!this.f) {
          this.f = $dn.create(this.c, this.d, this);
        }
        return this.f;
      }
    };
    $bn = class _$bn {
      static create(key, valueKey) {
        return new _$bn(key, valueKey);
      }
      constructor(d, f) {
        this.d = d;
        this.f = f;
        this.type = 10;
        this.c = null;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return cmp2(this.d, this.f, other.d, other.f);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.d === other.d && this.f === other.f;
        }
        return false;
      }
      substituteConstants() {
        return this;
      }
      evaluate(context) {
        const source = context.getValue(this.f);
        const item = context.getValue(this.d);
        if (Array.isArray(source)) {
          return source.includes(item);
        }
        if (typeof item === "string" && typeof source === "object" && source !== null) {
          return hasOwnProperty2.call(source, item);
        }
        return false;
      }
      serialize() {
        return `${this.d} in '${this.f}'`;
      }
      keys() {
        return [this.d, this.f];
      }
      map(mapFnc) {
        return mapFnc.mapIn(this.d, this.f);
      }
      negate() {
        if (!this.c) {
          this.c = $cn.create(this.d, this.f);
        }
        return this.c;
      }
    };
    $cn = class _$cn {
      static create(key, valueKey) {
        return new _$cn(key, valueKey);
      }
      constructor(d, f) {
        this.d = d;
        this.f = f;
        this.type = 11;
        this.c = $bn.create(d, f);
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return this.c.cmp(other.c);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.c.equals(other.c);
        }
        return false;
      }
      substituteConstants() {
        return this;
      }
      evaluate(context) {
        return !this.c.evaluate(context);
      }
      serialize() {
        return `${this.d} not in '${this.f}'`;
      }
      keys() {
        return this.c.keys();
      }
      map(mapFnc) {
        return mapFnc.mapNotIn(this.d, this.f);
      }
      negate() {
        return this.c;
      }
    };
    $dn = class _$dn {
      static create(key, value, negated = null) {
        if (typeof value === "boolean") {
          if (value) {
            return $en.create(key, negated);
          }
          return $_m.create(key, negated);
        }
        const constantValue = CONSTANT_VALUES.get(key);
        if (typeof constantValue === "boolean") {
          const falseValue = constantValue ? "true" : "false";
          return value === falseValue ? $0m.INSTANCE : $$m.INSTANCE;
        }
        return new _$dn(key, value, negated);
      }
      constructor(c, d, f) {
        this.c = c;
        this.d = d;
        this.f = f;
        this.type = 5;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return cmp2(this.c, this.d, other.c, other.d);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.c === other.c && this.d === other.d;
        }
        return false;
      }
      substituteConstants() {
        const constantValue = CONSTANT_VALUES.get(this.c);
        if (typeof constantValue === "boolean") {
          const falseValue = constantValue ? "true" : "false";
          return this.d === falseValue ? $0m.INSTANCE : $$m.INSTANCE;
        }
        return this;
      }
      evaluate(context) {
        return context.getValue(this.c) != this.d;
      }
      serialize() {
        return `${this.c} != '${this.d}'`;
      }
      keys() {
        return [this.c];
      }
      map(mapFnc) {
        return mapFnc.mapNotEquals(this.c, this.d);
      }
      negate() {
        if (!this.f) {
          this.f = $an.create(this.c, this.d, this);
        }
        return this.f;
      }
    };
    $en = class _$en {
      static create(key, negated = null) {
        const constantValue = CONSTANT_VALUES.get(key);
        if (typeof constantValue === "boolean") {
          return constantValue ? $0m.INSTANCE : $$m.INSTANCE;
        }
        return new _$en(key, negated);
      }
      constructor(c, d) {
        this.c = c;
        this.d = d;
        this.type = 3;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return cmp1(this.c, other.c);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.c === other.c;
        }
        return false;
      }
      substituteConstants() {
        const constantValue = CONSTANT_VALUES.get(this.c);
        if (typeof constantValue === "boolean") {
          return constantValue ? $0m.INSTANCE : $$m.INSTANCE;
        }
        return this;
      }
      evaluate(context) {
        return !context.getValue(this.c);
      }
      serialize() {
        return `!${this.c}`;
      }
      keys() {
        return [this.c];
      }
      map(mapFnc) {
        return mapFnc.mapNot(this.c);
      }
      negate() {
        if (!this.d) {
          this.d = $_m.create(this.c, this);
        }
        return this.d;
      }
    };
    $fn = class _$fn {
      static create(key, _value, negated = null) {
        return withFloatOrStr(_value, (value) => new _$fn(key, value, negated));
      }
      constructor(c, d, f) {
        this.c = c;
        this.d = d;
        this.f = f;
        this.type = 12;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return cmp2(this.c, this.d, other.c, other.d);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.c === other.c && this.d === other.d;
        }
        return false;
      }
      substituteConstants() {
        return this;
      }
      evaluate(context) {
        if (typeof this.d === "string") {
          return false;
        }
        return parseFloat(context.getValue(this.c)) > this.d;
      }
      serialize() {
        return `${this.c} > ${this.d}`;
      }
      keys() {
        return [this.c];
      }
      map(mapFnc) {
        return mapFnc.mapGreater(this.c, this.d);
      }
      negate() {
        if (!this.f) {
          this.f = $in.create(this.c, this.d, this);
        }
        return this.f;
      }
    };
    $gn = class _$gn {
      static create(key, _value, negated = null) {
        return withFloatOrStr(_value, (value) => new _$gn(key, value, negated));
      }
      constructor(c, d, f) {
        this.c = c;
        this.d = d;
        this.f = f;
        this.type = 13;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return cmp2(this.c, this.d, other.c, other.d);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.c === other.c && this.d === other.d;
        }
        return false;
      }
      substituteConstants() {
        return this;
      }
      evaluate(context) {
        if (typeof this.d === "string") {
          return false;
        }
        return parseFloat(context.getValue(this.c)) >= this.d;
      }
      serialize() {
        return `${this.c} >= ${this.d}`;
      }
      keys() {
        return [this.c];
      }
      map(mapFnc) {
        return mapFnc.mapGreaterEquals(this.c, this.d);
      }
      negate() {
        if (!this.f) {
          this.f = $hn.create(this.c, this.d, this);
        }
        return this.f;
      }
    };
    $hn = class _$hn {
      static create(key, _value, negated = null) {
        return withFloatOrStr(_value, (value) => new _$hn(key, value, negated));
      }
      constructor(c, d, f) {
        this.c = c;
        this.d = d;
        this.f = f;
        this.type = 14;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return cmp2(this.c, this.d, other.c, other.d);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.c === other.c && this.d === other.d;
        }
        return false;
      }
      substituteConstants() {
        return this;
      }
      evaluate(context) {
        if (typeof this.d === "string") {
          return false;
        }
        return parseFloat(context.getValue(this.c)) < this.d;
      }
      serialize() {
        return `${this.c} < ${this.d}`;
      }
      keys() {
        return [this.c];
      }
      map(mapFnc) {
        return mapFnc.mapSmaller(this.c, this.d);
      }
      negate() {
        if (!this.f) {
          this.f = $gn.create(this.c, this.d, this);
        }
        return this.f;
      }
    };
    $in = class _$in {
      static create(key, _value, negated = null) {
        return withFloatOrStr(_value, (value) => new _$in(key, value, negated));
      }
      constructor(c, d, f) {
        this.c = c;
        this.d = d;
        this.f = f;
        this.type = 15;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return cmp2(this.c, this.d, other.c, other.d);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.c === other.c && this.d === other.d;
        }
        return false;
      }
      substituteConstants() {
        return this;
      }
      evaluate(context) {
        if (typeof this.d === "string") {
          return false;
        }
        return parseFloat(context.getValue(this.c)) <= this.d;
      }
      serialize() {
        return `${this.c} <= ${this.d}`;
      }
      keys() {
        return [this.c];
      }
      map(mapFnc) {
        return mapFnc.mapSmallerEquals(this.c, this.d);
      }
      negate() {
        if (!this.f) {
          this.f = $fn.create(this.c, this.d, this);
        }
        return this.f;
      }
    };
    $jn = class _$jn {
      static create(key, regexp) {
        return new _$jn(key, regexp);
      }
      constructor(d, f) {
        this.d = d;
        this.f = f;
        this.type = 7;
        this.c = null;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        if (this.d < other.d) {
          return -1;
        }
        if (this.d > other.d) {
          return 1;
        }
        const thisSource = this.f ? this.f.source : "";
        const otherSource = other.f ? other.f.source : "";
        if (thisSource < otherSource) {
          return -1;
        }
        if (thisSource > otherSource) {
          return 1;
        }
        return 0;
      }
      equals(other) {
        if (other.type === this.type) {
          const thisSource = this.f ? this.f.source : "";
          const otherSource = other.f ? other.f.source : "";
          return this.d === other.d && thisSource === otherSource;
        }
        return false;
      }
      substituteConstants() {
        return this;
      }
      evaluate(context) {
        const value = context.getValue(this.d);
        return this.f ? this.f.test(value) : false;
      }
      serialize() {
        const value = this.f ? `/${this.f.source}/${this.f.flags}` : "/invalid/";
        return `${this.d} =~ ${value}`;
      }
      keys() {
        return [this.d];
      }
      map(mapFnc) {
        return mapFnc.mapRegex(this.d, this.f);
      }
      negate() {
        if (!this.c) {
          this.c = $kn.create(this);
        }
        return this.c;
      }
    };
    $kn = class _$kn {
      static create(actual) {
        return new _$kn(actual);
      }
      constructor(c) {
        this.c = c;
        this.type = 8;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        return this.c.cmp(other.c);
      }
      equals(other) {
        if (other.type === this.type) {
          return this.c.equals(other.c);
        }
        return false;
      }
      substituteConstants() {
        return this;
      }
      evaluate(context) {
        return !this.c.evaluate(context);
      }
      serialize() {
        return `!(${this.c.serialize()})`;
      }
      keys() {
        return this.c.keys();
      }
      map(mapFnc) {
        return new _$kn(this.c.map(mapFnc));
      }
      negate() {
        return this.c;
      }
    };
    $ln = class _$ln {
      static create(_expr, negated, extraRedundantCheck) {
        return _$ln.d(_expr, negated, extraRedundantCheck);
      }
      constructor(expr, c) {
        this.expr = expr;
        this.c = c;
        this.type = 6;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        if (this.expr.length < other.expr.length) {
          return -1;
        }
        if (this.expr.length > other.expr.length) {
          return 1;
        }
        for (let i = 0, len = this.expr.length; i < len; i++) {
          const r = cmp(this.expr[i], other.expr[i]);
          if (r !== 0) {
            return r;
          }
        }
        return 0;
      }
      equals(other) {
        if (other.type === this.type) {
          if (this.expr.length !== other.expr.length) {
            return false;
          }
          for (let i = 0, len = this.expr.length; i < len; i++) {
            if (!this.expr[i].equals(other.expr[i])) {
              return false;
            }
          }
          return true;
        }
        return false;
      }
      substituteConstants() {
        const exprArr = eliminateConstantsInArray(this.expr);
        if (exprArr === this.expr) {
          return this;
        }
        return _$ln.create(exprArr, this.c, false);
      }
      evaluate(context) {
        for (let i = 0, len = this.expr.length; i < len; i++) {
          if (!this.expr[i].evaluate(context)) {
            return false;
          }
        }
        return true;
      }
      static d(arr, negated, extraRedundantCheck) {
        const expr = [];
        let hasTrue = false;
        for (const e of arr) {
          if (!e) {
            continue;
          }
          if (e.type === 1) {
            hasTrue = true;
            continue;
          }
          if (e.type === 0) {
            return $0m.INSTANCE;
          }
          if (e.type === 6) {
            expr.push(...e.expr);
            continue;
          }
          expr.push(e);
        }
        if (expr.length === 0 && hasTrue) {
          return $$m.INSTANCE;
        }
        if (expr.length === 0) {
          return void 0;
        }
        if (expr.length === 1) {
          return expr[0];
        }
        expr.sort(cmp);
        for (let i = 1; i < expr.length; i++) {
          if (expr[i - 1].equals(expr[i])) {
            expr.splice(i, 1);
            i--;
          }
        }
        if (expr.length === 1) {
          return expr[0];
        }
        while (expr.length > 1) {
          const lastElement = expr[expr.length - 1];
          if (lastElement.type !== 9) {
            break;
          }
          expr.pop();
          const secondToLastElement = expr.pop();
          const isFinished = expr.length === 0;
          const resultElement = $mn.create(lastElement.expr.map((el) => _$ln.create([el, secondToLastElement], null, extraRedundantCheck)), null, isFinished);
          if (resultElement) {
            expr.push(resultElement);
            expr.sort(cmp);
          }
        }
        if (expr.length === 1) {
          return expr[0];
        }
        if (extraRedundantCheck) {
          for (let i = 0; i < expr.length; i++) {
            for (let j = i + 1; j < expr.length; j++) {
              if (expr[i].negate().equals(expr[j])) {
                return $0m.INSTANCE;
              }
            }
          }
          if (expr.length === 1) {
            return expr[0];
          }
        }
        return new _$ln(expr, negated);
      }
      serialize() {
        return this.expr.map((e) => e.serialize()).join(" && ");
      }
      keys() {
        const result = [];
        for (const expr of this.expr) {
          result.push(...expr.keys());
        }
        return result;
      }
      map(mapFnc) {
        return new _$ln(this.expr.map((expr) => expr.map(mapFnc)), null);
      }
      negate() {
        if (!this.c) {
          const result = [];
          for (const expr of this.expr) {
            result.push(expr.negate());
          }
          this.c = $mn.create(result, this, true);
        }
        return this.c;
      }
    };
    $mn = class _$mn {
      static create(_expr, negated, extraRedundantCheck) {
        return _$mn.d(_expr, negated, extraRedundantCheck);
      }
      constructor(expr, c) {
        this.expr = expr;
        this.c = c;
        this.type = 9;
      }
      cmp(other) {
        if (other.type !== this.type) {
          return this.type - other.type;
        }
        if (this.expr.length < other.expr.length) {
          return -1;
        }
        if (this.expr.length > other.expr.length) {
          return 1;
        }
        for (let i = 0, len = this.expr.length; i < len; i++) {
          const r = cmp(this.expr[i], other.expr[i]);
          if (r !== 0) {
            return r;
          }
        }
        return 0;
      }
      equals(other) {
        if (other.type === this.type) {
          if (this.expr.length !== other.expr.length) {
            return false;
          }
          for (let i = 0, len = this.expr.length; i < len; i++) {
            if (!this.expr[i].equals(other.expr[i])) {
              return false;
            }
          }
          return true;
        }
        return false;
      }
      substituteConstants() {
        const exprArr = eliminateConstantsInArray(this.expr);
        if (exprArr === this.expr) {
          return this;
        }
        return _$mn.create(exprArr, this.c, false);
      }
      evaluate(context) {
        for (let i = 0, len = this.expr.length; i < len; i++) {
          if (this.expr[i].evaluate(context)) {
            return true;
          }
        }
        return false;
      }
      static d(arr, negated, extraRedundantCheck) {
        let expr = [];
        let hasFalse = false;
        if (arr) {
          for (let i = 0, len = arr.length; i < len; i++) {
            const e = arr[i];
            if (!e) {
              continue;
            }
            if (e.type === 0) {
              hasFalse = true;
              continue;
            }
            if (e.type === 1) {
              return $$m.INSTANCE;
            }
            if (e.type === 9) {
              expr = expr.concat(e.expr);
              continue;
            }
            expr.push(e);
          }
          if (expr.length === 0 && hasFalse) {
            return $0m.INSTANCE;
          }
          expr.sort(cmp);
        }
        if (expr.length === 0) {
          return void 0;
        }
        if (expr.length === 1) {
          return expr[0];
        }
        for (let i = 1; i < expr.length; i++) {
          if (expr[i - 1].equals(expr[i])) {
            expr.splice(i, 1);
            i--;
          }
        }
        if (expr.length === 1) {
          return expr[0];
        }
        if (extraRedundantCheck) {
          for (let i = 0; i < expr.length; i++) {
            for (let j = i + 1; j < expr.length; j++) {
              if (expr[i].negate().equals(expr[j])) {
                return $$m.INSTANCE;
              }
            }
          }
          if (expr.length === 1) {
            return expr[0];
          }
        }
        return new _$mn(expr, negated);
      }
      serialize() {
        return this.expr.map((e) => e.serialize()).join(" || ");
      }
      keys() {
        const result = [];
        for (const expr of this.expr) {
          result.push(...expr.keys());
        }
        return result;
      }
      map(mapFnc) {
        return new _$mn(this.expr.map((expr) => expr.map(mapFnc)), null);
      }
      negate() {
        if (!this.c) {
          const result = [];
          for (const expr of this.expr) {
            result.push(expr.negate());
          }
          while (result.length > 1) {
            const LEFT = result.shift();
            const RIGHT = result.shift();
            const all = [];
            for (const left of getTerminals(LEFT)) {
              for (const right of getTerminals(RIGHT)) {
                all.push($ln.create([left, right], null, false));
              }
            }
            result.unshift(_$mn.create(all, null, false));
          }
          this.c = _$mn.create(result, this, true);
        }
        return this.c;
      }
    };
    $nn = class _$nn extends $_m {
      static {
        this.d = [];
      }
      static all() {
        return _$nn.d.values();
      }
      constructor(key, defaultValue, metaOrHide) {
        super(key, null);
        this.f = defaultValue;
        if (typeof metaOrHide === "object") {
          _$nn.d.push({ ...metaOrHide, key });
        } else if (metaOrHide !== true) {
          _$nn.d.push({ key, description: metaOrHide, type: defaultValue !== null && defaultValue !== void 0 ? typeof defaultValue : void 0 });
        }
      }
      bindTo(target) {
        return target.createKey(this.key, this.f);
      }
      getValue(target) {
        return target.getContextKeyValue(this.key);
      }
      toNegated() {
        return this.negate();
      }
      isEqualTo(value) {
        return $an.create(this.key, value);
      }
      notEqualsTo(value) {
        return $dn.create(this.key, value);
      }
    };
    $on = $Qk("contextKeyService");
  }
});

// out-build/vs/platform/log/common/log.js
function $yn(thing) {
  return $Dg(thing);
}
function log(logger, level, message) {
  switch (level) {
    case LogLevel.Trace:
      logger.trace(message);
      break;
    case LogLevel.Debug:
      logger.debug(message);
      break;
    case LogLevel.Info:
      logger.info(message);
      break;
    case LogLevel.Warning:
      logger.warn(message);
      break;
    case LogLevel.Error:
      logger.error(message);
      break;
    case LogLevel.Off:
      break;
    default:
      throw new Error(`Invalid log level ${level}`);
  }
}
function format(args, verbose = false) {
  let result = "";
  for (let i = 0; i < args.length; i++) {
    let a = args[i];
    if (a instanceof Error) {
      a = $1m(a, verbose);
    }
    if (typeof a === "object") {
      try {
        a = JSON.stringify(a);
      } catch (e) {
      }
    }
    result += (i > 0 ? " " : "") + a;
  }
  return result;
}
function $Kn(environmentService) {
  if (environmentService.verbose) {
    return LogLevel.Trace;
  }
  if (typeof environmentService.logLevel === "string") {
    const logLevel = $Nn(environmentService.logLevel.toLowerCase());
    if (logLevel !== void 0) {
      return logLevel;
    }
  }
  return $zn;
}
function $Ln(logLevel) {
  switch (logLevel) {
    case LogLevel.Trace:
      return "trace";
    case LogLevel.Debug:
      return "debug";
    case LogLevel.Info:
      return "info";
    case LogLevel.Warning:
      return "warn";
    case LogLevel.Error:
      return "error";
    case LogLevel.Off:
      return "off";
  }
}
function $Nn(logLevel) {
  switch (logLevel) {
    case "trace":
      return LogLevel.Trace;
    case "debug":
      return LogLevel.Debug;
    case "info":
      return LogLevel.Info;
    case "warn":
      return LogLevel.Warning;
    case "error":
      return LogLevel.Error;
    case "critical":
      return LogLevel.Error;
    case "off":
      return LogLevel.Off;
  }
  return void 0;
}
var $wn, $xn, LogLevel, $zn, $Bn, $Cn, $En, $Gn, $Hn, $In, $Jn, $On;
var init_log = __esm({
  "out-build/vs/platform/log/common/log.js"() {
    "use strict";
    init_nls2();
    init_errorMessage();
    init_event();
    init_hash();
    init_lifecycle();
    init_map();
    init_platform();
    init_resources();
    init_types();
    init_uri();
    init_contextkey();
    init_instantiation();
    $wn = $Qk("logService");
    $xn = $Qk("loggerService");
    (function(LogLevel2) {
      LogLevel2[LogLevel2["Off"] = 0] = "Off";
      LogLevel2[LogLevel2["Trace"] = 1] = "Trace";
      LogLevel2[LogLevel2["Debug"] = 2] = "Debug";
      LogLevel2[LogLevel2["Info"] = 3] = "Info";
      LogLevel2[LogLevel2["Warning"] = 4] = "Warning";
      LogLevel2[LogLevel2["Error"] = 5] = "Error";
    })(LogLevel || (LogLevel = {}));
    $zn = LogLevel.Info;
    $Bn = class extends $3c {
      constructor() {
        super(...arguments);
        this.b = $zn;
        this.c = this.B(new $ze());
        this.onDidChangeLogLevel = this.c.event;
      }
      setLevel(level) {
        if (this.b !== level) {
          this.b = level;
          this.c.fire(this.b);
        }
      }
      getLevel() {
        return this.b;
      }
      f(level) {
        return this.b !== LogLevel.Off && this.b <= level;
      }
      g(level) {
        if (this.q.isDisposed) {
          return false;
        }
        return this.f(level);
      }
    };
    $Cn = class extends $Bn {
      constructor(h) {
        super();
        this.h = h;
      }
      f(level) {
        return this.h || super.f(level);
      }
      trace(message, ...args) {
        if (this.g(LogLevel.Trace)) {
          this.m(LogLevel.Trace, format([message, ...args], true));
        }
      }
      debug(message, ...args) {
        if (this.g(LogLevel.Debug)) {
          this.m(LogLevel.Debug, format([message, ...args]));
        }
      }
      info(message, ...args) {
        if (this.g(LogLevel.Info)) {
          this.m(LogLevel.Info, format([message, ...args]));
        }
      }
      warn(message, ...args) {
        if (this.g(LogLevel.Warning)) {
          this.m(LogLevel.Warning, format([message, ...args]));
        }
      }
      error(message, ...args) {
        if (this.g(LogLevel.Error)) {
          if (message instanceof Error) {
            const array = Array.prototype.slice.call(arguments);
            array[0] = message.stack;
            this.m(LogLevel.Error, format(array));
          } else {
            this.m(LogLevel.Error, format([message, ...args]));
          }
        }
      }
      flush() {
      }
    };
    $En = class extends $Bn {
      constructor(logLevel = $zn, h = true) {
        super();
        this.h = h;
        this.setLevel(logLevel);
      }
      trace(message, ...args) {
        if (this.g(LogLevel.Trace)) {
          if (this.h) {
            console.log("%cTRACE", "color: #888", message, ...args);
          } else {
            console.log(message, ...args);
          }
        }
      }
      debug(message, ...args) {
        if (this.g(LogLevel.Debug)) {
          if (this.h) {
            console.log("%cDEBUG", "background: #eee; color: #888", message, ...args);
          } else {
            console.log(message, ...args);
          }
        }
      }
      info(message, ...args) {
        if (this.g(LogLevel.Info)) {
          if (this.h) {
            console.log("%c INFO", "color: #33f", message, ...args);
          } else {
            console.log(message, ...args);
          }
        }
      }
      warn(message, ...args) {
        if (this.g(LogLevel.Warning)) {
          if (this.h) {
            console.log("%c WARN", "color: #993", message, ...args);
          } else {
            console.log(message, ...args);
          }
        }
      }
      error(message, ...args) {
        if (this.g(LogLevel.Error)) {
          if (this.h) {
            console.log("%c  ERR", "color: #f33", message, ...args);
          } else {
            console.error(message, ...args);
          }
        }
      }
      flush() {
      }
    };
    $Gn = class extends $Bn {
      constructor(h) {
        super();
        this.h = h;
        if (h.length) {
          this.setLevel(h[0].getLevel());
        }
      }
      setLevel(level) {
        for (const logger of this.h) {
          logger.setLevel(level);
        }
        super.setLevel(level);
      }
      trace(message, ...args) {
        for (const logger of this.h) {
          logger.trace(message, ...args);
        }
      }
      debug(message, ...args) {
        for (const logger of this.h) {
          logger.debug(message, ...args);
        }
      }
      info(message, ...args) {
        for (const logger of this.h) {
          logger.info(message, ...args);
        }
      }
      warn(message, ...args) {
        for (const logger of this.h) {
          logger.warn(message, ...args);
        }
      }
      error(message, ...args) {
        for (const logger of this.h) {
          logger.error(message, ...args);
        }
      }
      flush() {
        for (const logger of this.h) {
          logger.flush();
        }
      }
      dispose() {
        for (const logger of this.h) {
          logger.dispose();
        }
        super.dispose();
      }
    };
    $Hn = class extends $3c {
      constructor(h, j, loggerResources) {
        super();
        this.h = h;
        this.j = j;
        this.b = new $Ec();
        this.c = this.B(new $ze());
        this.onDidChangeLoggers = this.c.event;
        this.f = this.B(new $ze());
        this.onDidChangeLogLevel = this.f.event;
        this.g = this.B(new $ze());
        this.onDidChangeVisibility = this.g.event;
        if (loggerResources) {
          for (const loggerResource of loggerResources) {
            this.b.set(loggerResource.resource, { logger: void 0, info: loggerResource });
          }
        }
      }
      m(resourceOrId) {
        if ($zg(resourceOrId)) {
          return [...this.b.values()].find((logger) => logger.info.id === resourceOrId);
        }
        return this.b.get(resourceOrId);
      }
      getLogger(resourceOrId) {
        return this.m(resourceOrId)?.logger;
      }
      createLogger(idOrResource, options2) {
        const resource = this.n(idOrResource);
        const id2 = $zg(idOrResource) ? idOrResource : options2?.id ?? $Xi(resource.toString()).toString(16);
        let logger = this.b.get(resource)?.logger;
        const logLevel = options2?.logLevel === "always" ? LogLevel.Trace : options2?.logLevel;
        if (!logger) {
          logger = this.s(resource, logLevel ?? this.getLogLevel(resource) ?? this.h, { ...options2, id: id2 });
        }
        const loggerEntry = {
          logger,
          info: { resource, id: id2, logLevel, name: options2?.name, hidden: options2?.hidden, extensionId: options2?.extensionId, when: options2?.when }
        };
        this.registerLogger(loggerEntry.info);
        this.b.set(resource, loggerEntry);
        return logger;
      }
      n(idOrResource) {
        return $zg(idOrResource) ? $vh(this.j, `${idOrResource}.log`) : idOrResource;
      }
      setLogLevel(arg1, arg2) {
        if (URI.isUri(arg1)) {
          const resource = arg1;
          const logLevel = arg2;
          const logger = this.b.get(resource);
          if (logger && logLevel !== logger.info.logLevel) {
            logger.info.logLevel = logLevel === this.h ? void 0 : logLevel;
            logger.logger?.setLevel(logLevel);
            this.b.set(logger.info.resource, logger);
            this.f.fire([resource, logLevel]);
          }
        } else {
          this.h = arg1;
          for (const [resource, logger] of this.b.entries()) {
            if (this.b.get(resource)?.info.logLevel === void 0) {
              logger.logger?.setLevel(this.h);
            }
          }
          this.f.fire(this.h);
        }
      }
      setVisibility(resourceOrId, visibility) {
        const logger = this.m(resourceOrId);
        if (logger && visibility !== !logger.info.hidden) {
          logger.info.hidden = !visibility;
          this.b.set(logger.info.resource, logger);
          this.g.fire([logger.info.resource, visibility]);
        }
      }
      getLogLevel(resource) {
        let logLevel;
        if (resource) {
          logLevel = this.b.get(resource)?.info.logLevel;
        }
        return logLevel ?? this.h;
      }
      registerLogger(resource) {
        const existing = this.b.get(resource.resource);
        if (existing) {
          if (existing.info.hidden !== resource.hidden) {
            this.setVisibility(resource.resource, !resource.hidden);
          }
        } else {
          this.b.set(resource.resource, { info: resource, logger: void 0 });
          this.c.fire({ added: [resource], removed: [] });
        }
      }
      deregisterLogger(resource) {
        const existing = this.b.get(resource);
        if (existing) {
          if (existing.logger) {
            existing.logger.dispose();
          }
          this.b.delete(resource);
          this.c.fire({ added: [], removed: [existing.info] });
        }
      }
      *getRegisteredLoggers() {
        for (const entry of this.b.values()) {
          yield entry.info;
        }
      }
      getRegisteredLogger(resource) {
        return this.b.get(resource)?.info;
      }
      dispose() {
        this.b.forEach((logger) => logger.logger?.dispose());
        this.b.clear();
        super.dispose();
      }
    };
    $In = class {
      constructor() {
        this.onDidChangeLogLevel = new $ze().event;
      }
      setLevel(level) {
      }
      getLevel() {
        return LogLevel.Info;
      }
      trace(message, ...args) {
      }
      debug(message, ...args) {
      }
      info(message, ...args) {
      }
      warn(message, ...args) {
      }
      error(message, ...args) {
      }
      critical(message, ...args) {
      }
      dispose() {
      }
      flush() {
      }
    };
    $Jn = class extends $In {
    };
    $On = new $nn("logLevel", $Ln(LogLevel.Info));
  }
});

// out-build/vs/platform/instantiation/common/descriptors.js
var $Nk;
var init_descriptors = __esm({
  "out-build/vs/platform/instantiation/common/descriptors.js"() {
    "use strict";
    $Nk = class {
      constructor(ctor, staticArguments = [], supportsDelayedInstantiation = false) {
        this.ctor = ctor;
        this.staticArguments = staticArguments;
        this.supportsDelayedInstantiation = supportsDelayedInstantiation;
      }
    };
  }
});

// out-build/vs/base/common/symbols.js
var $ue;
var init_symbols = __esm({
  "out-build/vs/base/common/symbols.js"() {
    "use strict";
    $ue = Symbol("MicrotaskDelay");
  }
});

// out-build/vs/base/common/async.js
function $Gh(obj) {
  return !!obj && typeof obj.then === "function";
}
function $Hh(callback) {
  const source = new $ad();
  const thenable = callback(source.token);
  const promise = new Promise((resolve4, reject) => {
    const subscription = source.token.onCancellationRequested(() => {
      subscription.dispose();
      reject(new $lb());
    });
    Promise.resolve(thenable).then((value) => {
      subscription.dispose();
      source.dispose();
      resolve4(value);
    }, (err) => {
      subscription.dispose();
      source.dispose();
      reject(err);
    });
  });
  return new class {
    cancel() {
      source.cancel();
      source.dispose();
    }
    then(resolve4, reject) {
      return promise.then(resolve4, reject);
    }
    catch(reject) {
      return this.then(void 0, reject);
    }
    finally(onfinally) {
      return promise.finally(onfinally);
    }
  }();
}
function $Oh() {
  let resolve4;
  let reject;
  const promise = new Promise((res, rej) => {
    resolve4 = res;
    reject = rej;
  });
  return { promise, resolve: resolve4, reject };
}
function $Wh(millis, token) {
  if (!token) {
    return $Hh((token2) => $Wh(millis, token2));
  }
  return new Promise((resolve4, reject) => {
    const handle = setTimeout(() => {
      disposable.dispose();
      resolve4();
    }, millis);
    const disposable = token.onCancellationRequested(() => {
      clearTimeout(handle);
      disposable.dispose();
      reject(new $lb());
    });
  });
}
async function $di(task, delay, retries) {
  let lastError;
  for (let i = 0; i < retries; i++) {
    try {
      return await task();
    } catch (error) {
      lastError = error;
      await $Wh(delay);
    }
  }
  throw lastError;
}
var $Ph, $Qh, timeoutDeferred, microtaskDeferred, $Sh, $Th, $Uh, $2h, $3h, $5h, $8h, $9h, $0h, $$h, $_h, $ai, $bi, $ci, DeferredOutcome, $gi, Promises, AsyncIterableSourceState, $ji;
var init_async = __esm({
  "out-build/vs/base/common/async.js"() {
    "use strict";
    init_cancellation();
    init_errors();
    init_event();
    init_lifecycle();
    init_resources();
    init_platform();
    init_symbols();
    init_lazy();
    $Ph = class {
      constructor() {
        this.f = false;
        this.a = null;
        this.b = null;
        this.d = null;
      }
      queue(promiseFactory) {
        if (this.f) {
          return Promise.reject(new Error("Throttler is disposed"));
        }
        if (this.a) {
          this.d = promiseFactory;
          if (!this.b) {
            const onComplete = () => {
              this.b = null;
              if (this.f) {
                return;
              }
              const result = this.queue(this.d);
              this.d = null;
              return result;
            };
            this.b = new Promise((resolve4) => {
              this.a.then(onComplete, onComplete).then(resolve4);
            });
          }
          return new Promise((resolve4, reject) => {
            this.b.then(resolve4, reject);
          });
        }
        this.a = promiseFactory();
        return new Promise((resolve4, reject) => {
          this.a.then((result) => {
            this.a = null;
            resolve4(result);
          }, (err) => {
            this.a = null;
            reject(err);
          });
        });
      }
      dispose() {
        this.f = true;
      }
    };
    $Qh = class {
      constructor() {
        this.a = Promise.resolve(null);
      }
      queue(promiseTask) {
        return this.a = this.a.then(() => promiseTask(), () => promiseTask());
      }
    };
    timeoutDeferred = (timeout, fn) => {
      let scheduled = true;
      const handle = setTimeout(() => {
        scheduled = false;
        fn();
      }, timeout);
      return {
        isTriggered: () => scheduled,
        dispose: () => {
          clearTimeout(handle);
          scheduled = false;
        }
      };
    };
    microtaskDeferred = (fn) => {
      let scheduled = true;
      queueMicrotask(() => {
        if (scheduled) {
          scheduled = false;
          fn();
        }
      });
      return {
        isTriggered: () => scheduled,
        dispose: () => {
          scheduled = false;
        }
      };
    };
    $Sh = class {
      constructor(defaultDelay) {
        this.defaultDelay = defaultDelay;
        this.a = null;
        this.b = null;
        this.d = null;
        this.f = null;
        this.g = null;
      }
      trigger(task, delay = this.defaultDelay) {
        this.g = task;
        this.h();
        if (!this.b) {
          this.b = new Promise((resolve4, reject) => {
            this.d = resolve4;
            this.f = reject;
          }).then(() => {
            this.b = null;
            this.d = null;
            if (this.g) {
              const task2 = this.g;
              this.g = null;
              return task2();
            }
            return void 0;
          });
        }
        const fn = () => {
          this.a = null;
          this.d?.(null);
        };
        this.a = delay === $ue ? microtaskDeferred(fn) : timeoutDeferred(delay, fn);
        return this.b;
      }
      isTriggered() {
        return !!this.a?.isTriggered();
      }
      cancel() {
        this.h();
        if (this.b) {
          this.f?.(new $lb());
          this.b = null;
        }
      }
      h() {
        this.a?.dispose();
        this.a = null;
      }
      dispose() {
        this.cancel();
      }
    };
    $Th = class {
      constructor(defaultDelay) {
        this.a = new $Sh(defaultDelay);
        this.b = new $Ph();
      }
      trigger(promiseFactory, delay) {
        return this.a.trigger(() => this.b.queue(promiseFactory), delay);
      }
      isTriggered() {
        return this.a.isTriggered();
      }
      cancel() {
        this.a.cancel();
      }
      dispose() {
        this.a.dispose();
        this.b.dispose();
      }
    };
    $Uh = class {
      constructor() {
        this.a = false;
        this.b = new Promise((c, e) => {
          this.d = c;
        });
      }
      isOpen() {
        return this.a;
      }
      open() {
        this.a = true;
        this.d(true);
      }
      wait() {
        return this.b;
      }
    };
    $2h = class {
      constructor(maxDegreeOfParalellism) {
        this.a = 0;
        this.b = false;
        this.f = maxDegreeOfParalellism;
        this.g = [];
        this.d = 0;
        this.h = new $ze();
      }
      /**
       *
       * @returns A promise that resolved when all work is done (onDrained) or when
       * there is nothing to do
       */
      whenIdle() {
        return this.size > 0 ? Event.toPromise(this.onDrained) : Promise.resolve();
      }
      get onDrained() {
        return this.h.event;
      }
      get size() {
        return this.a;
      }
      queue(factory) {
        if (this.b) {
          throw new Error("Object has been disposed");
        }
        this.a++;
        return new Promise((c, e) => {
          this.g.push({ factory, c, e });
          this.j();
        });
      }
      j() {
        while (this.g.length && this.d < this.f) {
          const iLimitedTask = this.g.shift();
          this.d++;
          const promise = iLimitedTask.factory();
          promise.then(iLimitedTask.c, iLimitedTask.e);
          promise.then(() => this.k(), () => this.k());
        }
      }
      k() {
        if (this.b) {
          return;
        }
        this.d--;
        if (--this.a === 0) {
          this.h.fire();
        }
        if (this.g.length > 0) {
          this.j();
        }
      }
      clear() {
        if (this.b) {
          throw new Error("Object has been disposed");
        }
        this.g.length = 0;
        this.a = this.d;
      }
      dispose() {
        this.b = true;
        this.g.length = 0;
        this.a = 0;
        this.h.dispose();
      }
    };
    $3h = class extends $2h {
      constructor() {
        super(1);
      }
    };
    $5h = class {
      constructor() {
        this.a = /* @__PURE__ */ new Map();
        this.b = /* @__PURE__ */ new Set();
        this.d = void 0;
        this.f = 0;
      }
      async whenDrained() {
        if (this.g()) {
          return;
        }
        const promise = new $gi();
        this.b.add(promise);
        return promise.p;
      }
      g() {
        for (const [, queue] of this.a) {
          if (queue.size > 0) {
            return false;
          }
        }
        return true;
      }
      queueSize(resource, extUri = $lh) {
        const key = extUri.getComparisonKey(resource);
        return this.a.get(key)?.size ?? 0;
      }
      queueFor(resource, factory, extUri = $lh) {
        const key = extUri.getComparisonKey(resource);
        let queue = this.a.get(key);
        if (!queue) {
          queue = new $3h();
          const drainListenerId = this.f++;
          const drainListener = Event.once(queue.onDrained)(() => {
            queue?.dispose();
            this.a.delete(key);
            this.h();
            this.d?.deleteAndDispose(drainListenerId);
            if (this.d?.size === 0) {
              this.d.dispose();
              this.d = void 0;
            }
          });
          if (!this.d) {
            this.d = new $_c();
          }
          this.d.set(drainListenerId, drainListener);
          this.a.set(key, queue);
        }
        return queue.queue(factory);
      }
      h() {
        if (!this.g()) {
          return;
        }
        this.j();
      }
      j() {
        for (const drainer of this.b) {
          drainer.complete();
        }
        this.b.clear();
      }
      dispose() {
        for (const [, queue] of this.a) {
          queue.dispose();
        }
        this.a.clear();
        this.j();
        this.d?.dispose();
      }
    };
    $8h = class {
      constructor(runner, delay) {
        this.b = -1;
        this.a = runner;
        this.d = delay;
        this.f = this.g.bind(this);
      }
      /**
       * Dispose RunOnceScheduler
       */
      dispose() {
        this.cancel();
        this.a = null;
      }
      /**
       * Cancel current scheduled runner (if any).
       */
      cancel() {
        if (this.isScheduled()) {
          clearTimeout(this.b);
          this.b = -1;
        }
      }
      /**
       * Cancel previous runner (if any) & schedule a new runner.
       */
      schedule(delay = this.d) {
        this.cancel();
        this.b = setTimeout(this.f, delay);
      }
      get delay() {
        return this.d;
      }
      set delay(value) {
        this.d = value;
      }
      /**
       * Returns true if scheduled.
       */
      isScheduled() {
        return this.b !== -1;
      }
      flush() {
        if (this.isScheduled()) {
          this.cancel();
          this.h();
        }
      }
      g() {
        this.b = -1;
        if (this.a) {
          this.h();
        }
      }
      h() {
        this.a?.();
      }
    };
    $9h = class {
      constructor(runner, delay) {
        if (delay % 1e3 !== 0) {
          console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);
        }
        this.a = runner;
        this.b = delay;
        this.d = 0;
        this.f = -1;
        this.g = this.h.bind(this);
      }
      dispose() {
        this.cancel();
        this.a = null;
      }
      cancel() {
        if (this.isScheduled()) {
          clearInterval(this.f);
          this.f = -1;
        }
      }
      /**
       * Cancel previous runner (if any) & schedule a new runner.
       */
      schedule(delay = this.b) {
        if (delay % 1e3 !== 0) {
          console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);
        }
        this.cancel();
        this.d = Math.ceil(delay / 1e3);
        this.f = setInterval(this.g, 1e3);
      }
      /**
       * Returns true if scheduled.
       */
      isScheduled() {
        return this.f !== -1;
      }
      h() {
        this.d--;
        if (this.d > 0) {
          return;
        }
        clearInterval(this.f);
        this.f = -1;
        this.a?.();
      }
    };
    $0h = class extends $8h {
      constructor(runner, timeout) {
        super(runner, timeout);
        this.j = [];
      }
      work(unit) {
        this.j.push(unit);
        if (!this.isScheduled()) {
          this.schedule();
        }
      }
      h() {
        const units = this.j;
        this.j = [];
        this.a?.(units);
      }
      dispose() {
        this.j = [];
        super.dispose();
      }
    };
    $$h = class extends $3c {
      constructor(h, j) {
        super();
        this.h = h;
        this.j = j;
        this.a = [];
        this.b = this.B(new $4c());
        this.f = false;
        this.g = 0;
      }
      /**
       * The number of work units that are pending to be processed.
       */
      get pending() {
        return this.a.length;
      }
      /**
       * Add units to be worked on. Use `pending` to figure out
       * how many units are not yet processed after this method
       * was called.
       *
       * @returns whether the work was accepted or not. If the
       * worker is disposed, it will not accept any more work.
       * If the number of pending units would become larger
       * than `maxPendingWork`, more work will also not be accepted.
       */
      work(units) {
        if (this.f) {
          return false;
        }
        if (typeof this.h.maxBufferedWork === "number") {
          if (this.b.value) {
            if (this.pending + units.length > this.h.maxBufferedWork) {
              return false;
            }
          } else {
            if (this.pending + units.length - this.h.maxWorkChunkSize > this.h.maxBufferedWork) {
              return false;
            }
          }
        }
        for (const unit of units) {
          this.a.push(unit);
        }
        const timeSinceLastExecution = Date.now() - this.g;
        if (!this.b.value && (!this.h.waitThrottleDelayBetweenWorkUnits || timeSinceLastExecution >= this.h.throttleDelay)) {
          this.m();
        } else if (!this.b.value && this.h.waitThrottleDelayBetweenWorkUnits) {
          this.r(Math.max(this.h.throttleDelay - timeSinceLastExecution, 0));
        } else {
        }
        return true;
      }
      m() {
        this.g = Date.now();
        this.j(this.a.splice(0, this.h.maxWorkChunkSize));
        if (this.a.length > 0) {
          this.r();
        }
      }
      r(delay = this.h.throttleDelay) {
        this.b.value = new $8h(() => {
          this.b.clear();
          this.m();
        }, delay);
        this.b.value.schedule();
      }
      dispose() {
        super.dispose();
        this.f = true;
      }
    };
    (function() {
      if (typeof globalThis.requestIdleCallback !== "function" || typeof globalThis.cancelIdleCallback !== "function") {
        $ai = (_targetWindow, runner, timeout) => {
          $E(() => {
            if (disposed) {
              return;
            }
            const end = Date.now() + 15;
            const deadline = {
              didTimeout: true,
              timeRemaining() {
                return Math.max(0, end - Date.now());
              }
            };
            runner(Object.freeze(deadline));
          });
          let disposed = false;
          return {
            dispose() {
              if (disposed) {
                return;
              }
              disposed = true;
            }
          };
        };
      } else {
        $ai = (targetWindow, runner, timeout) => {
          const handle = targetWindow.requestIdleCallback(runner, typeof timeout === "number" ? { timeout } : void 0);
          let disposed = false;
          return {
            dispose() {
              if (disposed) {
                return;
              }
              disposed = true;
              targetWindow.cancelIdleCallback(handle);
            }
          };
        };
      }
      $_h = (runner, timeout) => $ai(globalThis, runner, timeout);
    })();
    $bi = class {
      constructor(targetWindow, executor) {
        this.g = false;
        this.d = () => {
          try {
            this.j = executor();
          } catch (err) {
            this.l = err;
          } finally {
            this.g = true;
          }
        };
        this.f = $ai(targetWindow, () => this.d());
      }
      dispose() {
        this.f.dispose();
      }
      get value() {
        if (!this.g) {
          this.f.dispose();
          this.d();
        }
        if (this.l) {
          throw this.l;
        }
        return this.j;
      }
      get isInitialized() {
        return this.g;
      }
    };
    $ci = class extends $bi {
      constructor(executor) {
        super(globalThis, executor);
      }
    };
    (function(DeferredOutcome2) {
      DeferredOutcome2[DeferredOutcome2["Resolved"] = 0] = "Resolved";
      DeferredOutcome2[DeferredOutcome2["Rejected"] = 1] = "Rejected";
    })(DeferredOutcome || (DeferredOutcome = {}));
    $gi = class {
      get isRejected() {
        return this.d?.outcome === 1;
      }
      get isResolved() {
        return this.d?.outcome === 0;
      }
      get isSettled() {
        return !!this.d;
      }
      get value() {
        return this.d?.outcome === 0 ? this.d?.value : void 0;
      }
      constructor() {
        this.p = new Promise((c, e) => {
          this.a = c;
          this.b = e;
        });
      }
      complete(value) {
        return new Promise((resolve4) => {
          this.a(value);
          this.d = { outcome: 0, value };
          resolve4();
        });
      }
      error(err) {
        return new Promise((resolve4) => {
          this.b(err);
          this.d = { outcome: 1, value: err };
          resolve4();
        });
      }
      cancel() {
        return this.error(new $lb());
      }
    };
    (function(Promises3) {
      async function settled(promises15) {
        let firstError = void 0;
        const result = await Promise.all(promises15.map((promise) => promise.then((value) => value, (error) => {
          if (!firstError) {
            firstError = error;
          }
          return void 0;
        })));
        if (typeof firstError !== "undefined") {
          throw firstError;
        }
        return result;
      }
      Promises3.settled = settled;
      function withAsyncBody(bodyFn) {
        return new Promise(async (resolve4, reject) => {
          try {
            await bodyFn(resolve4, reject);
          } catch (error) {
            reject(error);
          }
        });
      }
      Promises3.withAsyncBody = withAsyncBody;
    })(Promises || (Promises = {}));
    (function(AsyncIterableSourceState2) {
      AsyncIterableSourceState2[AsyncIterableSourceState2["Initial"] = 0] = "Initial";
      AsyncIterableSourceState2[AsyncIterableSourceState2["DoneOK"] = 1] = "DoneOK";
      AsyncIterableSourceState2[AsyncIterableSourceState2["DoneError"] = 2] = "DoneError";
    })(AsyncIterableSourceState || (AsyncIterableSourceState = {}));
    $ji = class _$ji {
      static fromArray(items) {
        return new _$ji((writer) => {
          writer.emitMany(items);
        });
      }
      static fromPromise(promise) {
        return new _$ji(async (emitter) => {
          emitter.emitMany(await promise);
        });
      }
      static fromPromisesResolveOrder(promises15) {
        return new _$ji(async (emitter) => {
          await Promise.all(promises15.map(async (p) => emitter.emitOne(await p)));
        });
      }
      static merge(iterables) {
        return new _$ji(async (emitter) => {
          await Promise.all(iterables.map(async (iterable) => {
            for await (const item of iterable) {
              emitter.emitOne(item);
            }
          }));
        });
      }
      static {
        this.EMPTY = _$ji.fromArray([]);
      }
      constructor(executor, onReturn) {
        this.a = 0;
        this.b = [];
        this.d = null;
        this.f = onReturn;
        this.g = new $ze();
        queueMicrotask(async () => {
          const writer = {
            emitOne: (item) => this.h(item),
            emitMany: (items) => this.j(items),
            reject: (error) => this.l(error)
          };
          try {
            await Promise.resolve(executor(writer));
            this.k();
          } catch (err) {
            this.l(err);
          } finally {
            writer.emitOne = void 0;
            writer.emitMany = void 0;
            writer.reject = void 0;
          }
        });
      }
      [Symbol.asyncIterator]() {
        let i = 0;
        return {
          next: async () => {
            do {
              if (this.a === 2) {
                throw this.d;
              }
              if (i < this.b.length) {
                return { done: false, value: this.b[i++] };
              }
              if (this.a === 1) {
                return { done: true, value: void 0 };
              }
              await Event.toPromise(this.g.event);
            } while (true);
          },
          return: async () => {
            this.f?.();
            return { done: true, value: void 0 };
          }
        };
      }
      static map(iterable, mapFn) {
        return new _$ji(async (emitter) => {
          for await (const item of iterable) {
            emitter.emitOne(mapFn(item));
          }
        });
      }
      map(mapFn) {
        return _$ji.map(this, mapFn);
      }
      static filter(iterable, filterFn) {
        return new _$ji(async (emitter) => {
          for await (const item of iterable) {
            if (filterFn(item)) {
              emitter.emitOne(item);
            }
          }
        });
      }
      filter(filterFn) {
        return _$ji.filter(this, filterFn);
      }
      static coalesce(iterable) {
        return _$ji.filter(iterable, (item) => !!item);
      }
      coalesce() {
        return _$ji.coalesce(this);
      }
      static async toPromise(iterable) {
        const result = [];
        for await (const item of iterable) {
          result.push(item);
        }
        return result;
      }
      toPromise() {
        return _$ji.toPromise(this);
      }
      /**
       * The value will be appended at the end.
       *
       * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
       */
      h(value) {
        if (this.a !== 0) {
          return;
        }
        this.b.push(value);
        this.g.fire();
      }
      /**
       * The values will be appended at the end.
       *
       * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
       */
      j(values) {
        if (this.a !== 0) {
          return;
        }
        this.b = this.b.concat(values);
        this.g.fire();
      }
      /**
       * Calling `resolve()` will mark the result array as complete.
       *
       * **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise.
       * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
       */
      k() {
        if (this.a !== 0) {
          return;
        }
        this.a = 1;
        this.g.fire();
      }
      /**
       * Writing an error will permanently invalidate this iterable.
       * The current users will receive an error thrown, as will all future users.
       *
       * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
       */
      l(error) {
        if (this.a !== 0) {
          return;
        }
        this.a = 2;
        this.d = error;
        this.g.fire();
      }
    };
  }
});

// out-build/vs/base/common/json.js
function $ww(text, ignoreTrivia = false) {
  let pos = 0;
  const len = text.length;
  let value = "";
  let tokenOffset = 0;
  let token = 16;
  let scanError = 0;
  function scanHexDigits(count) {
    let digits = 0;
    let hexValue = 0;
    while (digits < count) {
      const ch = text.charCodeAt(pos);
      if (ch >= 48 && ch <= 57) {
        hexValue = hexValue * 16 + ch - 48;
      } else if (ch >= 65 && ch <= 70) {
        hexValue = hexValue * 16 + ch - 65 + 10;
      } else if (ch >= 97 && ch <= 102) {
        hexValue = hexValue * 16 + ch - 97 + 10;
      } else {
        break;
      }
      pos++;
      digits++;
    }
    if (digits < count) {
      hexValue = -1;
    }
    return hexValue;
  }
  function setPosition(newPosition) {
    pos = newPosition;
    value = "";
    tokenOffset = 0;
    token = 16;
    scanError = 0;
  }
  function scanNumber() {
    const start = pos;
    if (text.charCodeAt(pos) === 48) {
      pos++;
    } else {
      pos++;
      while (pos < text.length && isDigit(text.charCodeAt(pos))) {
        pos++;
      }
    }
    if (pos < text.length && text.charCodeAt(pos) === 46) {
      pos++;
      if (pos < text.length && isDigit(text.charCodeAt(pos))) {
        pos++;
        while (pos < text.length && isDigit(text.charCodeAt(pos))) {
          pos++;
        }
      } else {
        scanError = 3;
        return text.substring(start, pos);
      }
    }
    let end = pos;
    if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
      pos++;
      if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
        pos++;
      }
      if (pos < text.length && isDigit(text.charCodeAt(pos))) {
        pos++;
        while (pos < text.length && isDigit(text.charCodeAt(pos))) {
          pos++;
        }
        end = pos;
      } else {
        scanError = 3;
      }
    }
    return text.substring(start, end);
  }
  function scanString() {
    let result = "", start = pos;
    while (true) {
      if (pos >= len) {
        result += text.substring(start, pos);
        scanError = 2;
        break;
      }
      const ch = text.charCodeAt(pos);
      if (ch === 34) {
        result += text.substring(start, pos);
        pos++;
        break;
      }
      if (ch === 92) {
        result += text.substring(start, pos);
        pos++;
        if (pos >= len) {
          scanError = 2;
          break;
        }
        const ch2 = text.charCodeAt(pos++);
        switch (ch2) {
          case 34:
            result += '"';
            break;
          case 92:
            result += "\\";
            break;
          case 47:
            result += "/";
            break;
          case 98:
            result += "\b";
            break;
          case 102:
            result += "\f";
            break;
          case 110:
            result += "\n";
            break;
          case 114:
            result += "\r";
            break;
          case 116:
            result += "	";
            break;
          case 117: {
            const ch3 = scanHexDigits(4);
            if (ch3 >= 0) {
              result += String.fromCharCode(ch3);
            } else {
              scanError = 4;
            }
            break;
          }
          default:
            scanError = 5;
        }
        start = pos;
        continue;
      }
      if (ch >= 0 && ch <= 31) {
        if (isLineBreak(ch)) {
          result += text.substring(start, pos);
          scanError = 2;
          break;
        } else {
          scanError = 6;
        }
      }
      pos++;
    }
    return result;
  }
  function scanNext() {
    value = "";
    scanError = 0;
    tokenOffset = pos;
    if (pos >= len) {
      tokenOffset = len;
      return token = 17;
    }
    let code = text.charCodeAt(pos);
    if (isWhitespace(code)) {
      do {
        pos++;
        value += String.fromCharCode(code);
        code = text.charCodeAt(pos);
      } while (isWhitespace(code));
      return token = 15;
    }
    if (isLineBreak(code)) {
      pos++;
      value += String.fromCharCode(code);
      if (code === 13 && text.charCodeAt(pos) === 10) {
        pos++;
        value += "\n";
      }
      return token = 14;
    }
    switch (code) {
      case 123:
        pos++;
        return token = 1;
      case 125:
        pos++;
        return token = 2;
      case 91:
        pos++;
        return token = 3;
      case 93:
        pos++;
        return token = 4;
      case 58:
        pos++;
        return token = 6;
      case 44:
        pos++;
        return token = 5;
      case 34:
        pos++;
        value = scanString();
        return token = 10;
      case 47: {
        const start = pos - 1;
        if (text.charCodeAt(pos + 1) === 47) {
          pos += 2;
          while (pos < len) {
            if (isLineBreak(text.charCodeAt(pos))) {
              break;
            }
            pos++;
          }
          value = text.substring(start, pos);
          return token = 12;
        }
        if (text.charCodeAt(pos + 1) === 42) {
          pos += 2;
          const safeLength = len - 1;
          let commentClosed = false;
          while (pos < safeLength) {
            const ch = text.charCodeAt(pos);
            if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
              pos += 2;
              commentClosed = true;
              break;
            }
            pos++;
          }
          if (!commentClosed) {
            pos++;
            scanError = 1;
          }
          value = text.substring(start, pos);
          return token = 13;
        }
        value += String.fromCharCode(code);
        pos++;
        return token = 16;
      }
      case 45:
        value += String.fromCharCode(code);
        pos++;
        if (pos === len || !isDigit(text.charCodeAt(pos))) {
          return token = 16;
        }
      case 48:
      case 49:
      case 50:
      case 51:
      case 52:
      case 53:
      case 54:
      case 55:
      case 56:
      case 57:
        value += scanNumber();
        return token = 11;
      default:
        while (pos < len && isUnknownContentCharacter(code)) {
          pos++;
          code = text.charCodeAt(pos);
        }
        if (tokenOffset !== pos) {
          value = text.substring(tokenOffset, pos);
          switch (value) {
            case "true":
              return token = 8;
            case "false":
              return token = 9;
            case "null":
              return token = 7;
          }
          return token = 16;
        }
        value += String.fromCharCode(code);
        pos++;
        return token = 16;
    }
  }
  function isUnknownContentCharacter(code) {
    if (isWhitespace(code) || isLineBreak(code)) {
      return false;
    }
    switch (code) {
      case 125:
      case 93:
      case 123:
      case 91:
      case 34:
      case 58:
      case 44:
      case 47:
        return false;
    }
    return true;
  }
  function scanNextNonTrivia() {
    let result;
    do {
      result = scanNext();
    } while (result >= 12 && result <= 15);
    return result;
  }
  return {
    setPosition,
    getPosition: () => pos,
    scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
    getToken: () => token,
    getTokenValue: () => value,
    getTokenOffset: () => tokenOffset,
    getTokenLength: () => pos - tokenOffset,
    getTokenError: () => scanError
  };
}
function isWhitespace(ch) {
  return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279;
}
function isLineBreak(ch) {
  return ch === 10 || ch === 13 || ch === 8232 || ch === 8233;
}
function isDigit(ch) {
  return ch >= 48 && ch <= 57;
}
function $yw(text, errors = [], options2 = ParseOptions.DEFAULT) {
  let currentProperty = null;
  let currentParent = [];
  const previousParents = [];
  function onValue(value) {
    if (Array.isArray(currentParent)) {
      currentParent.push(value);
    } else if (currentProperty !== null) {
      currentParent[currentProperty] = value;
    }
  }
  const visitor = {
    onObjectBegin: () => {
      const object = {};
      onValue(object);
      previousParents.push(currentParent);
      currentParent = object;
      currentProperty = null;
    },
    onObjectProperty: (name) => {
      currentProperty = name;
    },
    onObjectEnd: () => {
      currentParent = previousParents.pop();
    },
    onArrayBegin: () => {
      const array = [];
      onValue(array);
      previousParents.push(currentParent);
      currentParent = array;
      currentProperty = null;
    },
    onArrayEnd: () => {
      currentParent = previousParents.pop();
    },
    onLiteralValue: onValue,
    onError: (error, offset, length) => {
      errors.push({ error, offset, length });
    }
  };
  $Fw(text, visitor, options2);
  return currentParent[0];
}
function $zw(text, errors = [], options2 = ParseOptions.DEFAULT) {
  let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
  function ensurePropertyComplete(endOffset) {
    if (currentParent.type === "property") {
      currentParent.length = endOffset - currentParent.offset;
      currentParent = currentParent.parent;
    }
  }
  function onValue(valueNode) {
    currentParent.children.push(valueNode);
    return valueNode;
  }
  const visitor = {
    onObjectBegin: (offset) => {
      currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
    },
    onObjectProperty: (name, offset, length) => {
      currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
      currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
    },
    onObjectEnd: (offset, length) => {
      currentParent.length = offset + length - currentParent.offset;
      currentParent = currentParent.parent;
      ensurePropertyComplete(offset + length);
    },
    onArrayBegin: (offset, length) => {
      currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
    },
    onArrayEnd: (offset, length) => {
      currentParent.length = offset + length - currentParent.offset;
      currentParent = currentParent.parent;
      ensurePropertyComplete(offset + length);
    },
    onLiteralValue: (value, offset, length) => {
      onValue({ type: $Gw(value), offset, length, parent: currentParent, value });
      ensurePropertyComplete(offset + length);
    },
    onSeparator: (sep2, offset, length) => {
      if (currentParent.type === "property") {
        if (sep2 === ":") {
          currentParent.colonOffset = offset;
        } else if (sep2 === ",") {
          ensurePropertyComplete(offset);
        }
      }
    },
    onError: (error, offset, length) => {
      errors.push({ error, offset, length });
    }
  };
  $Fw(text, visitor, options2);
  const result = currentParent.children[0];
  if (result) {
    delete result.parent;
  }
  return result;
}
function $Aw(root, path7) {
  if (!root) {
    return void 0;
  }
  let node = root;
  for (const segment of path7) {
    if (typeof segment === "string") {
      if (node.type !== "object" || !Array.isArray(node.children)) {
        return void 0;
      }
      let found = false;
      for (const propertyNode of node.children) {
        if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment) {
          node = propertyNode.children[1];
          found = true;
          break;
        }
      }
      if (!found) {
        return void 0;
      }
    } else {
      const index = segment;
      if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
        return void 0;
      }
      node = node.children[index];
    }
  }
  return node;
}
function $Fw(text, visitor, options2 = ParseOptions.DEFAULT) {
  const _scanner = $ww(text, false);
  function toNoArgVisit(visitFunction) {
    return visitFunction ? () => visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength()) : () => true;
  }
  function toOneArgVisit(visitFunction) {
    return visitFunction ? (arg) => visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength()) : () => true;
  }
  const onObjectBegin = toNoArgVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisit(visitor.onObjectProperty), onObjectEnd = toNoArgVisit(visitor.onObjectEnd), onArrayBegin = toNoArgVisit(visitor.onArrayBegin), onArrayEnd = toNoArgVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisit(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
  const disallowComments = options2 && options2.disallowComments;
  const allowTrailingComma = options2 && options2.allowTrailingComma;
  function scanNext() {
    while (true) {
      const token = _scanner.scan();
      switch (_scanner.getTokenError()) {
        case 4:
          handleError(
            14
            /* ParseErrorCode.InvalidUnicode */
          );
          break;
        case 5:
          handleError(
            15
            /* ParseErrorCode.InvalidEscapeCharacter */
          );
          break;
        case 3:
          handleError(
            13
            /* ParseErrorCode.UnexpectedEndOfNumber */
          );
          break;
        case 1:
          if (!disallowComments) {
            handleError(
              11
              /* ParseErrorCode.UnexpectedEndOfComment */
            );
          }
          break;
        case 2:
          handleError(
            12
            /* ParseErrorCode.UnexpectedEndOfString */
          );
          break;
        case 6:
          handleError(
            16
            /* ParseErrorCode.InvalidCharacter */
          );
          break;
      }
      switch (token) {
        case 12:
        case 13:
          if (disallowComments) {
            handleError(
              10
              /* ParseErrorCode.InvalidCommentToken */
            );
          } else {
            onComment();
          }
          break;
        case 16:
          handleError(
            1
            /* ParseErrorCode.InvalidSymbol */
          );
          break;
        case 15:
        case 14:
          break;
        default:
          return token;
      }
    }
  }
  function handleError(error, skipUntilAfter = [], skipUntil = []) {
    onError(error);
    if (skipUntilAfter.length + skipUntil.length > 0) {
      let token = _scanner.getToken();
      while (token !== 17) {
        if (skipUntilAfter.indexOf(token) !== -1) {
          scanNext();
          break;
        } else if (skipUntil.indexOf(token) !== -1) {
          break;
        }
        token = scanNext();
      }
    }
  }
  function parseString(isValue) {
    const value = _scanner.getTokenValue();
    if (isValue) {
      onLiteralValue(value);
    } else {
      onObjectProperty(value);
    }
    scanNext();
    return true;
  }
  function parseLiteral() {
    switch (_scanner.getToken()) {
      case 11: {
        let value = 0;
        try {
          value = JSON.parse(_scanner.getTokenValue());
          if (typeof value !== "number") {
            handleError(
              2
              /* ParseErrorCode.InvalidNumberFormat */
            );
            value = 0;
          }
        } catch (e) {
          handleError(
            2
            /* ParseErrorCode.InvalidNumberFormat */
          );
        }
        onLiteralValue(value);
        break;
      }
      case 7:
        onLiteralValue(null);
        break;
      case 8:
        onLiteralValue(true);
        break;
      case 9:
        onLiteralValue(false);
        break;
      default:
        return false;
    }
    scanNext();
    return true;
  }
  function parseProperty() {
    if (_scanner.getToken() !== 10) {
      handleError(3, [], [
        2,
        5
        /* SyntaxKind.CommaToken */
      ]);
      return false;
    }
    parseString(false);
    if (_scanner.getToken() === 6) {
      onSeparator(":");
      scanNext();
      if (!parseValue()) {
        handleError(4, [], [
          2,
          5
          /* SyntaxKind.CommaToken */
        ]);
      }
    } else {
      handleError(5, [], [
        2,
        5
        /* SyntaxKind.CommaToken */
      ]);
    }
    return true;
  }
  function parseObject() {
    onObjectBegin();
    scanNext();
    let needsComma = false;
    while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
      if (_scanner.getToken() === 5) {
        if (!needsComma) {
          handleError(4, [], []);
        }
        onSeparator(",");
        scanNext();
        if (_scanner.getToken() === 2 && allowTrailingComma) {
          break;
        }
      } else if (needsComma) {
        handleError(6, [], []);
      }
      if (!parseProperty()) {
        handleError(4, [], [
          2,
          5
          /* SyntaxKind.CommaToken */
        ]);
      }
      needsComma = true;
    }
    onObjectEnd();
    if (_scanner.getToken() !== 2) {
      handleError(7, [
        2
        /* SyntaxKind.CloseBraceToken */
      ], []);
    } else {
      scanNext();
    }
    return true;
  }
  function parseArray() {
    onArrayBegin();
    scanNext();
    let needsComma = false;
    while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
      if (_scanner.getToken() === 5) {
        if (!needsComma) {
          handleError(4, [], []);
        }
        onSeparator(",");
        scanNext();
        if (_scanner.getToken() === 4 && allowTrailingComma) {
          break;
        }
      } else if (needsComma) {
        handleError(6, [], []);
      }
      if (!parseValue()) {
        handleError(4, [], [
          4,
          5
          /* SyntaxKind.CommaToken */
        ]);
      }
      needsComma = true;
    }
    onArrayEnd();
    if (_scanner.getToken() !== 4) {
      handleError(8, [
        4
        /* SyntaxKind.CloseBracketToken */
      ], []);
    } else {
      scanNext();
    }
    return true;
  }
  function parseValue() {
    switch (_scanner.getToken()) {
      case 3:
        return parseArray();
      case 1:
        return parseObject();
      case 10:
        return parseString(true);
      default:
        return parseLiteral();
    }
  }
  scanNext();
  if (_scanner.getToken() === 17) {
    if (options2.allowEmptyContent) {
      return true;
    }
    handleError(4, [], []);
    return false;
  }
  if (!parseValue()) {
    handleError(4, [], []);
    return false;
  }
  if (_scanner.getToken() !== 17) {
    handleError(9, [], []);
  }
  return true;
}
function $Gw(value) {
  switch (typeof value) {
    case "boolean":
      return "boolean";
    case "number":
      return "number";
    case "string":
      return "string";
    case "object": {
      if (!value) {
        return "null";
      } else if (Array.isArray(value)) {
        return "array";
      }
      return "object";
    }
    default:
      return "null";
  }
}
var ScanError, SyntaxKind, ParseErrorCode, ParseOptions, CharacterCodes;
var init_json = __esm({
  "out-build/vs/base/common/json.js"() {
    "use strict";
    (function(ScanError2) {
      ScanError2[ScanError2["None"] = 0] = "None";
      ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
      ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
      ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
      ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
      ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
      ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
    })(ScanError || (ScanError = {}));
    (function(SyntaxKind2) {
      SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
      SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
      SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
      SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
      SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
      SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
      SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
      SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
      SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
      SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
      SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
      SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
      SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
      SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
      SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
      SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
      SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
    })(SyntaxKind || (SyntaxKind = {}));
    (function(ParseErrorCode2) {
      ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
      ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
      ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
      ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
      ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
      ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
      ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
      ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
      ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
      ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
      ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
      ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
      ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
      ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
      ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
      ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
    })(ParseErrorCode || (ParseErrorCode = {}));
    (function(ParseOptions2) {
      ParseOptions2.DEFAULT = {
        allowTrailingComma: true
      };
    })(ParseOptions || (ParseOptions = {}));
    (function(CharacterCodes2) {
      CharacterCodes2[CharacterCodes2["nullCharacter"] = 0] = "nullCharacter";
      CharacterCodes2[CharacterCodes2["maxAsciiCharacter"] = 127] = "maxAsciiCharacter";
      CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
      CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
      CharacterCodes2[CharacterCodes2["lineSeparator"] = 8232] = "lineSeparator";
      CharacterCodes2[CharacterCodes2["paragraphSeparator"] = 8233] = "paragraphSeparator";
      CharacterCodes2[CharacterCodes2["nextLine"] = 133] = "nextLine";
      CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
      CharacterCodes2[CharacterCodes2["nonBreakingSpace"] = 160] = "nonBreakingSpace";
      CharacterCodes2[CharacterCodes2["enQuad"] = 8192] = "enQuad";
      CharacterCodes2[CharacterCodes2["emQuad"] = 8193] = "emQuad";
      CharacterCodes2[CharacterCodes2["enSpace"] = 8194] = "enSpace";
      CharacterCodes2[CharacterCodes2["emSpace"] = 8195] = "emSpace";
      CharacterCodes2[CharacterCodes2["threePerEmSpace"] = 8196] = "threePerEmSpace";
      CharacterCodes2[CharacterCodes2["fourPerEmSpace"] = 8197] = "fourPerEmSpace";
      CharacterCodes2[CharacterCodes2["sixPerEmSpace"] = 8198] = "sixPerEmSpace";
      CharacterCodes2[CharacterCodes2["figureSpace"] = 8199] = "figureSpace";
      CharacterCodes2[CharacterCodes2["punctuationSpace"] = 8200] = "punctuationSpace";
      CharacterCodes2[CharacterCodes2["thinSpace"] = 8201] = "thinSpace";
      CharacterCodes2[CharacterCodes2["hairSpace"] = 8202] = "hairSpace";
      CharacterCodes2[CharacterCodes2["zeroWidthSpace"] = 8203] = "zeroWidthSpace";
      CharacterCodes2[CharacterCodes2["narrowNoBreakSpace"] = 8239] = "narrowNoBreakSpace";
      CharacterCodes2[CharacterCodes2["ideographicSpace"] = 12288] = "ideographicSpace";
      CharacterCodes2[CharacterCodes2["mathematicalSpace"] = 8287] = "mathematicalSpace";
      CharacterCodes2[CharacterCodes2["ogham"] = 5760] = "ogham";
      CharacterCodes2[CharacterCodes2["_"] = 95] = "_";
      CharacterCodes2[CharacterCodes2["$"] = 36] = "$";
      CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
      CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
      CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
      CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
      CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
      CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
      CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
      CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
      CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
      CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
      CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
      CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
      CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
      CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
      CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
      CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
      CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
      CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
      CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
      CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
      CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
      CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
      CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
      CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
      CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
      CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
      CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
      CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
      CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
      CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
      CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
      CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
      CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
      CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
      CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
      CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
      CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
      CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
      CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
      CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
      CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
      CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
      CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
      CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
      CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
      CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
      CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
      CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
      CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
      CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
      CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
      CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
      CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
      CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
      CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
      CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
      CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
      CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
      CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
      CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
      CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
      CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
      CharacterCodes2[CharacterCodes2["ampersand"] = 38] = "ampersand";
      CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
      CharacterCodes2[CharacterCodes2["at"] = 64] = "at";
      CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
      CharacterCodes2[CharacterCodes2["bar"] = 124] = "bar";
      CharacterCodes2[CharacterCodes2["caret"] = 94] = "caret";
      CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
      CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
      CharacterCodes2[CharacterCodes2["closeParen"] = 41] = "closeParen";
      CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
      CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
      CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
      CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
      CharacterCodes2[CharacterCodes2["equals"] = 61] = "equals";
      CharacterCodes2[CharacterCodes2["exclamation"] = 33] = "exclamation";
      CharacterCodes2[CharacterCodes2["greaterThan"] = 62] = "greaterThan";
      CharacterCodes2[CharacterCodes2["lessThan"] = 60] = "lessThan";
      CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
      CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
      CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
      CharacterCodes2[CharacterCodes2["openParen"] = 40] = "openParen";
      CharacterCodes2[CharacterCodes2["percent"] = 37] = "percent";
      CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
      CharacterCodes2[CharacterCodes2["question"] = 63] = "question";
      CharacterCodes2[CharacterCodes2["semicolon"] = 59] = "semicolon";
      CharacterCodes2[CharacterCodes2["singleQuote"] = 39] = "singleQuote";
      CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
      CharacterCodes2[CharacterCodes2["tilde"] = 126] = "tilde";
      CharacterCodes2[CharacterCodes2["backspace"] = 8] = "backspace";
      CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
      CharacterCodes2[CharacterCodes2["byteOrderMark"] = 65279] = "byteOrderMark";
      CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
      CharacterCodes2[CharacterCodes2["verticalTab"] = 11] = "verticalTab";
    })(CharacterCodes || (CharacterCodes = {}));
  }
});

// out-build/vs/base/common/jsonFormatter.js
function $Sw(documentText, range, options2) {
  let initialIndentLevel;
  let formatText;
  let formatTextStart;
  let rangeStart;
  let rangeEnd;
  if (range) {
    rangeStart = range.offset;
    rangeEnd = rangeStart + range.length;
    formatTextStart = rangeStart;
    while (formatTextStart > 0 && !$Vw(documentText, formatTextStart - 1)) {
      formatTextStart--;
    }
    let endOffset = rangeEnd;
    while (endOffset < documentText.length && !$Vw(documentText, endOffset)) {
      endOffset++;
    }
    formatText = documentText.substring(formatTextStart, endOffset);
    initialIndentLevel = computeIndentLevel(formatText, options2);
  } else {
    formatText = documentText;
    initialIndentLevel = 0;
    formatTextStart = 0;
    rangeStart = 0;
    rangeEnd = documentText.length;
  }
  const eol = $Uw(options2, documentText);
  let lineBreak = false;
  let indentLevel = 0;
  let indentValue;
  if (options2.insertSpaces) {
    indentValue = repeat(" ", options2.tabSize || 4);
  } else {
    indentValue = "	";
  }
  const scanner = $ww(formatText, false);
  let hasError = false;
  function newLineAndIndent() {
    return eol + repeat(indentValue, initialIndentLevel + indentLevel);
  }
  function scanNext() {
    let token = scanner.scan();
    lineBreak = false;
    while (token === 15 || token === 14) {
      lineBreak = lineBreak || token === 14;
      token = scanner.scan();
    }
    hasError = token === 16 || scanner.getTokenError() !== 0;
    return token;
  }
  const editOperations = [];
  function addEdit(text, startOffset, endOffset) {
    if (!hasError && startOffset < rangeEnd && endOffset > rangeStart && documentText.substring(startOffset, endOffset) !== text) {
      editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
    }
  }
  let firstToken = scanNext();
  if (firstToken !== 17) {
    const firstTokenStart = scanner.getTokenOffset() + formatTextStart;
    const initialIndent = repeat(indentValue, initialIndentLevel);
    addEdit(initialIndent, formatTextStart, firstTokenStart);
  }
  while (firstToken !== 17) {
    let firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
    let secondToken = scanNext();
    let replaceContent = "";
    while (!lineBreak && (secondToken === 12 || secondToken === 13)) {
      const commentTokenStart = scanner.getTokenOffset() + formatTextStart;
      addEdit(" ", firstTokenEnd, commentTokenStart);
      firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
      replaceContent = secondToken === 12 ? newLineAndIndent() : "";
      secondToken = scanNext();
    }
    if (secondToken === 2) {
      if (firstToken !== 1) {
        indentLevel--;
        replaceContent = newLineAndIndent();
      }
    } else if (secondToken === 4) {
      if (firstToken !== 3) {
        indentLevel--;
        replaceContent = newLineAndIndent();
      }
    } else {
      switch (firstToken) {
        case 3:
        case 1:
          indentLevel++;
          replaceContent = newLineAndIndent();
          break;
        case 5:
        case 12:
          replaceContent = newLineAndIndent();
          break;
        case 13:
          if (lineBreak) {
            replaceContent = newLineAndIndent();
          } else {
            replaceContent = " ";
          }
          break;
        case 6:
          replaceContent = " ";
          break;
        case 10:
          if (secondToken === 6) {
            replaceContent = "";
            break;
          }
        case 7:
        case 8:
        case 9:
        case 11:
        case 2:
        case 4:
          if (secondToken === 12 || secondToken === 13) {
            replaceContent = " ";
          } else if (secondToken !== 5 && secondToken !== 17) {
            hasError = true;
          }
          break;
        case 16:
          hasError = true;
          break;
      }
      if (lineBreak && (secondToken === 12 || secondToken === 13)) {
        replaceContent = newLineAndIndent();
      }
    }
    const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
    addEdit(replaceContent, firstTokenEnd, secondTokenStart);
    firstToken = secondToken;
  }
  return editOperations;
}
function repeat(s, count) {
  let result = "";
  for (let i = 0; i < count; i++) {
    result += s;
  }
  return result;
}
function computeIndentLevel(content, options2) {
  let i = 0;
  let nChars = 0;
  const tabSize = options2.tabSize || 4;
  while (i < content.length) {
    const ch = content.charAt(i);
    if (ch === " ") {
      nChars++;
    } else if (ch === "	") {
      nChars += tabSize;
    } else {
      break;
    }
    i++;
  }
  return Math.floor(nChars / tabSize);
}
function $Uw(options2, text) {
  for (let i = 0; i < text.length; i++) {
    const ch = text.charAt(i);
    if (ch === "\r") {
      if (i + 1 < text.length && text.charAt(i + 1) === "\n") {
        return "\r\n";
      }
      return "\r";
    } else if (ch === "\n") {
      return "\n";
    }
  }
  return options2 && options2.eol || "\n";
}
function $Vw(text, offset) {
  return "\r\n".indexOf(text.charAt(offset)) !== -1;
}
var init_jsonFormatter = __esm({
  "out-build/vs/base/common/jsonFormatter.js"() {
    "use strict";
    init_json();
  }
});

// out-build/vs/base/common/jsonEdit.js
function $Xw(text, originalPath, value, formattingOptions, getInsertionIndex) {
  const path7 = originalPath.slice();
  const errors = [];
  const root = $zw(text, errors);
  let parent = void 0;
  let lastSegment = void 0;
  while (path7.length > 0) {
    lastSegment = path7.pop();
    parent = $Aw(root, path7);
    if (parent === void 0 && value !== void 0) {
      if (typeof lastSegment === "string") {
        value = { [lastSegment]: value };
      } else {
        value = [value];
      }
    } else {
      break;
    }
  }
  if (!parent) {
    if (value === void 0) {
      return [];
    }
    return $Yw(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, formattingOptions);
  } else if (parent.type === "object" && typeof lastSegment === "string" && Array.isArray(parent.children)) {
    const existing = $Aw(parent, [lastSegment]);
    if (existing !== void 0) {
      if (value === void 0) {
        if (!existing.parent) {
          throw new Error("Malformed AST");
        }
        const propertyIndex = parent.children.indexOf(existing.parent);
        let removeBegin;
        let removeEnd = existing.parent.offset + existing.parent.length;
        if (propertyIndex > 0) {
          const previous = parent.children[propertyIndex - 1];
          removeBegin = previous.offset + previous.length;
        } else {
          removeBegin = parent.offset + 1;
          if (parent.children.length > 1) {
            const next = parent.children[1];
            removeEnd = next.offset;
          }
        }
        return $Yw(text, { offset: removeBegin, length: removeEnd - removeBegin, content: "" }, formattingOptions);
      } else {
        return $Yw(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, formattingOptions);
      }
    } else {
      if (value === void 0) {
        return [];
      }
      const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
      const index = getInsertionIndex ? getInsertionIndex(parent.children.map((p) => p.children[0].value)) : parent.children.length;
      let edit2;
      if (index > 0) {
        const previous = parent.children[index - 1];
        edit2 = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
      } else if (parent.children.length === 0) {
        edit2 = { offset: parent.offset + 1, length: 0, content: newProperty };
      } else {
        edit2 = { offset: parent.offset + 1, length: 0, content: newProperty + "," };
      }
      return $Yw(text, edit2, formattingOptions);
    }
  } else if (parent.type === "array" && typeof lastSegment === "number" && Array.isArray(parent.children)) {
    if (value !== void 0) {
      const newProperty = `${JSON.stringify(value)}`;
      let edit2;
      if (parent.children.length === 0 || lastSegment === 0) {
        edit2 = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + "," };
      } else {
        const index = lastSegment === -1 || lastSegment > parent.children.length ? parent.children.length : lastSegment;
        const previous = parent.children[index - 1];
        edit2 = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
      }
      return $Yw(text, edit2, formattingOptions);
    } else {
      const removalIndex = lastSegment;
      const toRemove = parent.children[removalIndex];
      let edit2;
      if (parent.children.length === 1) {
        edit2 = { offset: parent.offset + 1, length: parent.length - 2, content: "" };
      } else if (parent.children.length - 1 === removalIndex) {
        const previous = parent.children[removalIndex - 1];
        const offset = previous.offset + previous.length;
        const parentEndOffset = parent.offset + parent.length;
        edit2 = { offset, length: parentEndOffset - 2 - offset, content: "" };
      } else {
        edit2 = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: "" };
      }
      return $Yw(text, edit2, formattingOptions);
    }
  } else {
    throw new Error(`Can not add ${typeof lastSegment !== "number" ? "index" : "property"} to parent of type ${parent.type}`);
  }
}
function $Yw(text, edit2, formattingOptions) {
  let newText = $Zw(text, edit2);
  let begin = edit2.offset;
  let end = edit2.offset + edit2.content.length;
  if (edit2.length === 0 || edit2.content.length === 0) {
    while (begin > 0 && !$Vw(newText, begin - 1)) {
      begin--;
    }
    while (end < newText.length && !$Vw(newText, end)) {
      end++;
    }
  }
  const edits = $Sw(newText, { offset: begin, length: end - begin }, formattingOptions);
  for (let i = edits.length - 1; i >= 0; i--) {
    const curr = edits[i];
    newText = $Zw(newText, curr);
    begin = Math.min(begin, curr.offset);
    end = Math.max(end, curr.offset + curr.length);
    end += curr.content.length - curr.length;
  }
  const editLength = text.length - (newText.length - end) - begin;
  return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
}
function $Zw(text, edit2) {
  return text.substring(0, edit2.offset) + edit2.content + text.substring(edit2.offset + edit2.length);
}
function $1w(text, edits) {
  const sortedEdits = edits.slice(0).sort((a, b) => {
    const diff2 = a.offset - b.offset;
    if (diff2 === 0) {
      return a.length - b.length;
    }
    return diff2;
  });
  let lastModifiedOffset = text.length;
  for (let i = sortedEdits.length - 1; i >= 0; i--) {
    const e = sortedEdits[i];
    if (e.offset + e.length <= lastModifiedOffset) {
      text = $Zw(text, e);
    } else {
      throw new Error("Overlapping edit");
    }
    lastModifiedOffset = e.offset;
  }
  return text;
}
var init_jsonEdit = __esm({
  "out-build/vs/base/common/jsonEdit.js"() {
    "use strict";
    init_json();
    init_jsonFormatter();
  }
});

// out-build/vs/base/common/objects.js
function $Lv(obj) {
  if (!obj || typeof obj !== "object") {
    return obj;
  }
  if (obj instanceof RegExp) {
    return obj;
  }
  const result = Array.isArray(obj) ? [] : {};
  Object.entries(obj).forEach(([key, value]) => {
    result[key] = value && typeof value === "object" ? $Lv(value) : value;
  });
  return result;
}
function $Mv(obj) {
  if (!obj || typeof obj !== "object") {
    return obj;
  }
  const stack = [obj];
  while (stack.length > 0) {
    const obj2 = stack.shift();
    Object.freeze(obj2);
    for (const key in obj2) {
      if (_hasOwnProperty.call(obj2, key)) {
        const prop = obj2[key];
        if (typeof prop === "object" && !Object.isFrozen(prop) && !$Cg(prop)) {
          stack.push(prop);
        }
      }
    }
  }
  return obj;
}
function $Nv(obj, changer) {
  return _cloneAndChange(obj, changer, /* @__PURE__ */ new Set());
}
function _cloneAndChange(obj, changer, seen) {
  if ($Ig(obj)) {
    return obj;
  }
  const changed = changer(obj);
  if (typeof changed !== "undefined") {
    return changed;
  }
  if (Array.isArray(obj)) {
    const r1 = [];
    for (const e of obj) {
      r1.push(_cloneAndChange(e, changer, seen));
    }
    return r1;
  }
  if ($Bg(obj)) {
    if (seen.has(obj)) {
      throw new Error("Cannot clone recursive data-structure");
    }
    seen.add(obj);
    const r2 = {};
    for (const i2 in obj) {
      if (_hasOwnProperty.call(obj, i2)) {
        r2[i2] = _cloneAndChange(obj[i2], changer, seen);
      }
    }
    seen.delete(obj);
    return r2;
  }
  return obj;
}
function $Ov(destination, source, overwrite = true) {
  if (!$Bg(destination)) {
    return source;
  }
  if ($Bg(source)) {
    Object.keys(source).forEach((key) => {
      if (key in destination) {
        if (overwrite) {
          if ($Bg(destination[key]) && $Bg(source[key])) {
            $Ov(destination[key], source[key], overwrite);
          } else {
            destination[key] = source[key];
          }
        }
      } else {
        destination[key] = source[key];
      }
    });
  }
  return destination;
}
function $Pv(one, other) {
  if (one === other) {
    return true;
  }
  if (one === null || one === void 0 || other === null || other === void 0) {
    return false;
  }
  if (typeof one !== typeof other) {
    return false;
  }
  if (typeof one !== "object") {
    return false;
  }
  if (Array.isArray(one) !== Array.isArray(other)) {
    return false;
  }
  let i;
  let key;
  if (Array.isArray(one)) {
    if (one.length !== other.length) {
      return false;
    }
    for (i = 0; i < one.length; i++) {
      if (!$Pv(one[i], other[i])) {
        return false;
      }
    }
  } else {
    const oneKeys = [];
    for (key in one) {
      oneKeys.push(key);
    }
    oneKeys.sort();
    const otherKeys = [];
    for (key in other) {
      otherKeys.push(key);
    }
    otherKeys.sort();
    if (!$Pv(oneKeys, otherKeys)) {
      return false;
    }
    for (i = 0; i < oneKeys.length; i++) {
      if (!$Pv(one[oneKeys[i]], other[oneKeys[i]])) {
        return false;
      }
    }
  }
  return true;
}
function $Qv(obj) {
  const seen = /* @__PURE__ */ new Set();
  return JSON.stringify(obj, (key, value) => {
    if ($Bg(value) || Array.isArray(value)) {
      if (seen.has(value)) {
        return "[Circular]";
      } else {
        seen.add(value);
      }
    }
    if (typeof value === "bigint") {
      return `[BigInt ${value.toString()}]`;
    }
    return value;
  });
}
function $Sv(target, key) {
  const lowercaseKey = key.toLowerCase();
  const equivalentKey = Object.keys(target).find((k) => k.toLowerCase() === lowercaseKey);
  return equivalentKey ? target[equivalentKey] : target[key];
}
var _hasOwnProperty;
var init_objects = __esm({
  "out-build/vs/base/common/objects.js"() {
    "use strict";
    init_types();
    _hasOwnProperty = Object.prototype.hasOwnProperty;
  }
});

// out-build/vs/platform/configuration/common/configuration.js
function $ll(thing) {
  return thing && typeof thing === "object" && (!thing.overrideIdentifier || typeof thing.overrideIdentifier === "string") && (!thing.resource || thing.resource instanceof URI);
}
function $ml(thing) {
  return thing && typeof thing === "object" && (!thing.overrideIdentifiers || Array.isArray(thing.overrideIdentifiers)) && !thing.overrideIdentifier && (!thing.resource || thing.resource instanceof URI);
}
function $pl(properties, conflictReporter) {
  const root = /* @__PURE__ */ Object.create(null);
  for (const key in properties) {
    $ql(root, key, properties[key], conflictReporter);
  }
  return root;
}
function $ql(settingsTreeRoot, key, value, conflictReporter) {
  const segments = key.split(".");
  const last = segments.pop();
  let curr = settingsTreeRoot;
  for (let i = 0; i < segments.length; i++) {
    const s = segments[i];
    let obj = curr[s];
    switch (typeof obj) {
      case "undefined":
        obj = curr[s] = /* @__PURE__ */ Object.create(null);
        break;
      case "object":
        if (obj === null) {
          conflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join(".")} is null`);
          return;
        }
        break;
      default:
        conflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join(".")} is ${JSON.stringify(obj)}`);
        return;
    }
    curr = obj;
  }
  if (typeof curr === "object" && curr !== null) {
    try {
      curr[last] = value;
    } catch (e) {
      conflictReporter(`Ignoring ${key} as ${segments.join(".")} is ${JSON.stringify(curr)}`);
    }
  } else {
    conflictReporter(`Ignoring ${key} as ${segments.join(".")} is ${JSON.stringify(curr)}`);
  }
}
function $rl(valueTree, key) {
  const segments = key.split(".");
  doRemoveFromValueTree(valueTree, segments);
}
function doRemoveFromValueTree(valueTree, segments) {
  const first = segments.shift();
  if (segments.length === 0) {
    delete valueTree[first];
    return;
  }
  if (Object.keys(valueTree).indexOf(first) !== -1) {
    const value = valueTree[first];
    if (typeof value === "object" && !Array.isArray(value)) {
      doRemoveFromValueTree(value, segments);
      if (Object.keys(value).length === 0) {
        delete valueTree[first];
      }
    }
  }
}
function $sl(config, settingPath, defaultValue) {
  function accessSetting(config2, path8) {
    let current = config2;
    for (const component of path8) {
      if (typeof current !== "object" || current === null) {
        return void 0;
      }
      current = current[component];
    }
    return current;
  }
  const path7 = settingPath.split(".");
  const result = accessSetting(config, path7);
  return typeof result === "undefined" ? defaultValue : result;
}
function $ul(settingKey) {
  return settingKey.replace(/[\[\]]/g, "");
}
var $kl, ConfigurationTarget;
var init_configuration = __esm({
  "out-build/vs/platform/configuration/common/configuration.js"() {
    "use strict";
    init_types();
    init_uri();
    init_instantiation();
    $kl = $Qk("configurationService");
    (function(ConfigurationTarget3) {
      ConfigurationTarget3[ConfigurationTarget3["APPLICATION"] = 1] = "APPLICATION";
      ConfigurationTarget3[ConfigurationTarget3["USER"] = 2] = "USER";
      ConfigurationTarget3[ConfigurationTarget3["USER_LOCAL"] = 3] = "USER_LOCAL";
      ConfigurationTarget3[ConfigurationTarget3["USER_REMOTE"] = 4] = "USER_REMOTE";
      ConfigurationTarget3[ConfigurationTarget3["WORKSPACE"] = 5] = "WORKSPACE";
      ConfigurationTarget3[ConfigurationTarget3["WORKSPACE_FOLDER"] = 6] = "WORKSPACE_FOLDER";
      ConfigurationTarget3[ConfigurationTarget3["DEFAULT"] = 7] = "DEFAULT";
      ConfigurationTarget3[ConfigurationTarget3["MEMORY"] = 8] = "MEMORY";
    })(ConfigurationTarget || (ConfigurationTarget = {}));
  }
});

// out-build/vs/base/common/jsonSchema.js
function $rn(schema) {
  let hasDups = false;
  const equalsByString = /* @__PURE__ */ new Map();
  const nodeToEquals = /* @__PURE__ */ new Map();
  const visitSchemas = (next) => {
    if (schema === next) {
      return true;
    }
    const val = JSON.stringify(next);
    if (val.length < 30) {
      return true;
    }
    const eq2 = equalsByString.get(val);
    if (!eq2) {
      const newEq = { schemas: [next] };
      equalsByString.set(val, newEq);
      nodeToEquals.set(next, newEq);
      return true;
    }
    eq2.schemas.push(next);
    nodeToEquals.set(next, eq2);
    hasDups = true;
    return false;
  };
  traverseNodes(schema, visitSchemas);
  equalsByString.clear();
  if (!hasDups) {
    return JSON.stringify(schema);
  }
  let defNodeName = "$defs";
  while (schema.hasOwnProperty(defNodeName)) {
    defNodeName += "_";
  }
  const definitions = [];
  function stringify(root) {
    return JSON.stringify(root, (_key, value) => {
      if (value !== root) {
        const eq2 = nodeToEquals.get(value);
        if (eq2 && eq2.schemas.length > 1) {
          if (!eq2.id) {
            eq2.id = `_${definitions.length}`;
            definitions.push(eq2.schemas[0]);
          }
          return { $ref: `#/${defNodeName}/${eq2.id}` };
        }
      }
      return value;
    });
  }
  const str = stringify(schema);
  const defStrings = [];
  for (let i = 0; i < definitions.length; i++) {
    defStrings.push(`"_${i}":${stringify(definitions[i])}`);
  }
  if (defStrings.length) {
    return `${str.substring(0, str.length - 1)},"${defNodeName}":{${defStrings.join(",")}}}`;
  }
  return str;
}
function isObject(thing) {
  return typeof thing === "object" && thing !== null;
}
function traverseNodes(root, visit) {
  if (!root || typeof root !== "object") {
    return;
  }
  const collectEntries = (...entries) => {
    for (const entry of entries) {
      if (isObject(entry)) {
        toWalk.push(entry);
      }
    }
  };
  const collectMapEntries = (...maps) => {
    for (const map of maps) {
      if (isObject(map)) {
        for (const key in map) {
          const entry = map[key];
          if (isObject(entry)) {
            toWalk.push(entry);
          }
        }
      }
    }
  };
  const collectArrayEntries = (...arrays) => {
    for (const array of arrays) {
      if (Array.isArray(array)) {
        for (const entry of array) {
          if (isObject(entry)) {
            toWalk.push(entry);
          }
        }
      }
    }
  };
  const collectEntryOrArrayEntries = (items) => {
    if (Array.isArray(items)) {
      for (const entry of items) {
        if (isObject(entry)) {
          toWalk.push(entry);
        }
      }
    } else if (isObject(items)) {
      toWalk.push(items);
    }
  };
  const toWalk = [root];
  let next = toWalk.pop();
  while (next) {
    const visitChildern = visit(next);
    if (visitChildern) {
      collectEntries(next.additionalItems, next.additionalProperties, next.not, next.contains, next.propertyNames, next.if, next.then, next.else, next.unevaluatedItems, next.unevaluatedProperties);
      collectMapEntries(next.definitions, next.$defs, next.properties, next.patternProperties, next.dependencies, next.dependentSchemas);
      collectArrayEntries(next.anyOf, next.allOf, next.oneOf, next.prefixItems);
      collectEntryOrArrayEntries(next.items);
    }
    next = toWalk.pop();
  }
}
var init_jsonSchema = __esm({
  "out-build/vs/base/common/jsonSchema.js"() {
    "use strict";
  }
});

// out-build/vs/base/common/assert.js
function ok(value, message) {
  if (!value) {
    throw new Error(message ? `Assertion failed (${message})` : "Assertion Failed");
  }
}
function $kd(condition) {
  if (!condition()) {
    debugger;
    condition();
    $gb(new $vb("Assertion Failed"));
  }
}
var init_assert = __esm({
  "out-build/vs/base/common/assert.js"() {
    "use strict";
    init_errors();
  }
});

// out-build/vs/platform/registry/common/platform.js
var RegistryImpl, $Wn;
var init_platform2 = __esm({
  "out-build/vs/platform/registry/common/platform.js"() {
    "use strict";
    init_assert();
    init_types();
    RegistryImpl = class {
      constructor() {
        this.a = /* @__PURE__ */ new Map();
      }
      add(id2, data) {
        ok($zg(id2));
        ok($Bg(data));
        ok(!this.a.has(id2), "There is already an extension with this id");
        this.a.set(id2, data);
      }
      knows(id2) {
        return this.a.has(id2);
      }
      as(id2) {
        return this.a.get(id2) || null;
      }
    };
    $Wn = new RegistryImpl();
  }
});

// out-build/vs/platform/jsonschemas/common/jsonContributionRegistry.js
function normalizeId(id2) {
  if (id2.length > 0 && id2.charAt(id2.length - 1) === "#") {
    return id2.substring(0, id2.length - 1);
  }
  return id2;
}
var $Xn, JSONContributionRegistry, jsonContributionRegistry;
var init_jsonContributionRegistry = __esm({
  "out-build/vs/platform/jsonschemas/common/jsonContributionRegistry.js"() {
    "use strict";
    init_event();
    init_jsonSchema();
    init_platform2();
    $Xn = {
      JSONContribution: "base.contributions.json"
    };
    JSONContributionRegistry = class {
      constructor() {
        this.b = new $ze();
        this.onDidChangeSchema = this.b.event;
        this.a = {};
      }
      registerSchema(uri, unresolvedSchemaContent) {
        this.a[normalizeId(uri)] = unresolvedSchemaContent;
        this.b.fire(uri);
      }
      notifySchemaChanged(uri) {
        this.b.fire(uri);
      }
      getSchemaContributions() {
        return {
          schemas: this.a
        };
      }
      getSchemaContent(uri) {
        const schema = this.a[uri];
        return schema ? $rn(schema) : void 0;
      }
      hasSchemaContent(uri) {
        return !!this.a[uri];
      }
    };
    jsonContributionRegistry = new JSONContributionRegistry();
    $Wn.add($Xn.JSONContribution, jsonContributionRegistry);
  }
});

// out-build/vs/platform/configuration/common/configurationRegistry.js
function $St(key) {
  const identifiers2 = [];
  if ($Rt.test(key)) {
    let matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);
    while (matches?.length) {
      const identifier = matches[1].trim();
      if (identifier) {
        identifiers2.push(identifier);
      }
      matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);
    }
  }
  return $Rb(identifiers2);
}
function $Tt(overrideIdentifiers) {
  return overrideIdentifiers.reduce((result, overrideIdentifier) => `${result}[${overrideIdentifier}]`, "");
}
function $Ut(type2) {
  const t = Array.isArray(type2) ? type2[0] : type2;
  switch (t) {
    case "boolean":
      return false;
    case "integer":
    case "number":
      return 0;
    case "string":
      return "";
    case "array":
      return [];
    case "object":
      return {};
    default:
      return null;
  }
}
function $Vt(property, schema) {
  if (!property.trim()) {
    return localize(1699, null);
  }
  if ($Rt.test(property)) {
    return localize(1700, null, property);
  }
  if (configurationRegistry.getConfigurationProperties()[property] !== void 0) {
    return localize(1701, null, property);
  }
  if (schema.policy?.name && configurationRegistry.getPolicyConfigurations().get(schema.policy?.name) !== void 0) {
    return localize(1702, null, property, schema.policy?.name, configurationRegistry.getPolicyConfigurations().get(schema.policy?.name));
  }
  return null;
}
var EditPresentationTypes, $Ht, ConfigurationScope, $It, $Jt, $Kt, $Lt, $Mt, $Nt, $Ot, contributionRegistry, ConfigurationRegistry, OVERRIDE_IDENTIFIER_PATTERN, OVERRIDE_IDENTIFIER_REGEX, $Qt, $Rt, configurationRegistry;
var init_configurationRegistry = __esm({
  "out-build/vs/platform/configuration/common/configurationRegistry.js"() {
    "use strict";
    init_arrays();
    init_event();
    init_types();
    init_nls2();
    init_configuration();
    init_jsonContributionRegistry();
    init_platform2();
    (function(EditPresentationTypes2) {
      EditPresentationTypes2["Multiline"] = "multilineText";
      EditPresentationTypes2["Singleline"] = "singlelineText";
    })(EditPresentationTypes || (EditPresentationTypes = {}));
    $Ht = {
      Configuration: "base.contributions.configuration"
    };
    (function(ConfigurationScope2) {
      ConfigurationScope2[ConfigurationScope2["APPLICATION"] = 1] = "APPLICATION";
      ConfigurationScope2[ConfigurationScope2["MACHINE"] = 2] = "MACHINE";
      ConfigurationScope2[ConfigurationScope2["WINDOW"] = 3] = "WINDOW";
      ConfigurationScope2[ConfigurationScope2["RESOURCE"] = 4] = "RESOURCE";
      ConfigurationScope2[ConfigurationScope2["LANGUAGE_OVERRIDABLE"] = 5] = "LANGUAGE_OVERRIDABLE";
      ConfigurationScope2[ConfigurationScope2["MACHINE_OVERRIDABLE"] = 6] = "MACHINE_OVERRIDABLE";
    })(ConfigurationScope || (ConfigurationScope = {}));
    $It = { properties: {}, patternProperties: {} };
    $Jt = { properties: {}, patternProperties: {} };
    $Kt = { properties: {}, patternProperties: {} };
    $Lt = { properties: {}, patternProperties: {} };
    $Mt = { properties: {}, patternProperties: {} };
    $Nt = { properties: {}, patternProperties: {} };
    $Ot = "vscode://schemas/settings/resourceLanguage";
    contributionRegistry = $Wn.as($Xn.JSONContribution);
    ConfigurationRegistry = class {
      constructor() {
        this.a = [];
        this.i = /* @__PURE__ */ new Set();
        this.j = new $ze();
        this.onDidSchemaChange = this.j.event;
        this.k = new $ze();
        this.onDidUpdateConfiguration = this.k.event;
        this.b = /* @__PURE__ */ new Map();
        this.c = {
          id: "defaultOverrides",
          title: localize(1693, null),
          properties: {}
        };
        this.d = [this.c];
        this.h = {
          properties: {},
          patternProperties: {},
          additionalProperties: true,
          allowTrailingCommas: true,
          allowComments: true
        };
        this.e = {};
        this.f = /* @__PURE__ */ new Map();
        this.g = {};
        contributionRegistry.registerSchema($Ot, this.h);
        this.z();
      }
      registerConfiguration(configuration, validate = true) {
        this.registerConfigurations([configuration], validate);
      }
      registerConfigurations(configurations, validate = true) {
        const properties = /* @__PURE__ */ new Set();
        this.r(configurations, validate, properties);
        contributionRegistry.registerSchema($Ot, this.h);
        this.j.fire();
        this.k.fire({ properties });
      }
      deregisterConfigurations(configurations) {
        const properties = /* @__PURE__ */ new Set();
        this.s(configurations, properties);
        contributionRegistry.registerSchema($Ot, this.h);
        this.j.fire();
        this.k.fire({ properties });
      }
      updateConfigurations({ add, remove }) {
        const properties = /* @__PURE__ */ new Set();
        this.s(remove, properties);
        this.r(add, false, properties);
        contributionRegistry.registerSchema($Ot, this.h);
        this.j.fire();
        this.k.fire({ properties });
      }
      registerDefaultConfigurations(configurationDefaults) {
        const properties = /* @__PURE__ */ new Set();
        this.l(configurationDefaults, properties);
        this.j.fire();
        this.k.fire({ properties, defaultsOverrides: true });
      }
      l(configurationDefaults, bucket) {
        this.a.push(...configurationDefaults);
        const overrideIdentifiers = [];
        for (const { overrides, source } of configurationDefaults) {
          for (const key in overrides) {
            bucket.add(key);
            const configurationDefaultOverridesForKey = this.b.get(key) ?? this.b.set(key, { configurationDefaultOverrides: [] }).get(key);
            const value = overrides[key];
            configurationDefaultOverridesForKey.configurationDefaultOverrides.push({ value, source });
            if ($Rt.test(key)) {
              const newDefaultOverride = this.o(key, value, source, configurationDefaultOverridesForKey.configurationDefaultOverrideValue);
              if (!newDefaultOverride) {
                continue;
              }
              configurationDefaultOverridesForKey.configurationDefaultOverrideValue = newDefaultOverride;
              this.n(key, newDefaultOverride, source);
              overrideIdentifiers.push(...$St(key));
            } else {
              const newDefaultOverride = this.p(key, value, source, configurationDefaultOverridesForKey.configurationDefaultOverrideValue);
              if (!newDefaultOverride) {
                continue;
              }
              configurationDefaultOverridesForKey.configurationDefaultOverrideValue = newDefaultOverride;
              const property = this.e[key];
              if (property) {
                this.A(key, property);
                this.w(key, property);
              }
            }
          }
        }
        this.q(overrideIdentifiers);
      }
      deregisterDefaultConfigurations(defaultConfigurations) {
        const properties = /* @__PURE__ */ new Set();
        this.m(defaultConfigurations, properties);
        this.j.fire();
        this.k.fire({ properties, defaultsOverrides: true });
      }
      m(defaultConfigurations, bucket) {
        for (const defaultConfiguration of defaultConfigurations) {
          const index = this.a.indexOf(defaultConfiguration);
          if (index !== -1) {
            this.a.splice(index, 1);
          }
        }
        for (const { overrides, source } of defaultConfigurations) {
          for (const key in overrides) {
            const configurationDefaultOverridesForKey = this.b.get(key);
            if (!configurationDefaultOverridesForKey) {
              continue;
            }
            const index = configurationDefaultOverridesForKey.configurationDefaultOverrides.findIndex((configurationDefaultOverride) => source ? configurationDefaultOverride.source?.id === source.id : configurationDefaultOverride.value === overrides[key]);
            if (index === -1) {
              continue;
            }
            configurationDefaultOverridesForKey.configurationDefaultOverrides.splice(index, 1);
            if (configurationDefaultOverridesForKey.configurationDefaultOverrides.length === 0) {
              this.b.delete(key);
            }
            if ($Rt.test(key)) {
              let configurationDefaultOverrideValue;
              for (const configurationDefaultOverride of configurationDefaultOverridesForKey.configurationDefaultOverrides) {
                configurationDefaultOverrideValue = this.o(key, configurationDefaultOverride.value, configurationDefaultOverride.source, configurationDefaultOverrideValue);
              }
              if (configurationDefaultOverrideValue && !$Mg(configurationDefaultOverrideValue.value)) {
                configurationDefaultOverridesForKey.configurationDefaultOverrideValue = configurationDefaultOverrideValue;
                this.n(key, configurationDefaultOverrideValue, source);
              } else {
                this.b.delete(key);
                delete this.e[key];
                delete this.c.properties[key];
              }
            } else {
              let configurationDefaultOverrideValue;
              for (const configurationDefaultOverride of configurationDefaultOverridesForKey.configurationDefaultOverrides) {
                configurationDefaultOverrideValue = this.p(key, configurationDefaultOverride.value, configurationDefaultOverride.source, configurationDefaultOverrideValue);
              }
              configurationDefaultOverridesForKey.configurationDefaultOverrideValue = configurationDefaultOverrideValue;
              const property = this.e[key];
              if (property) {
                this.A(key, property);
                this.w(key, property);
              }
            }
            bucket.add(key);
          }
        }
        this.y();
      }
      n(key, newDefaultOverride, source) {
        const property = {
          type: "object",
          default: newDefaultOverride.value,
          description: localize(1694, null, $ul(key)),
          $ref: $Ot,
          defaultDefaultValue: newDefaultOverride.value,
          source,
          defaultValueSource: source
        };
        this.e[key] = property;
        this.c.properties[key] = property;
      }
      o(overrideIdentifier, configurationValueObject, valueSource, existingDefaultOverride) {
        const defaultValue = existingDefaultOverride?.value || {};
        const source = existingDefaultOverride?.source ?? /* @__PURE__ */ new Map();
        if (!(source instanceof Map)) {
          console.error("objectConfigurationSources is not a Map");
          return void 0;
        }
        for (const propertyKey of Object.keys(configurationValueObject)) {
          const propertyDefaultValue = configurationValueObject[propertyKey];
          const isObjectSetting = $Bg(propertyDefaultValue) && ($Gg(defaultValue[propertyKey]) || $Bg(defaultValue[propertyKey]));
          if (isObjectSetting) {
            defaultValue[propertyKey] = { ...defaultValue[propertyKey] ?? {}, ...propertyDefaultValue };
            if (valueSource) {
              for (const objectKey in propertyDefaultValue) {
                source.set(`${propertyKey}.${objectKey}`, valueSource);
              }
            }
          } else {
            defaultValue[propertyKey] = propertyDefaultValue;
            if (valueSource) {
              source.set(propertyKey, valueSource);
            } else {
              source.delete(propertyKey);
            }
          }
        }
        return { value: defaultValue, source };
      }
      p(propertyKey, value, valuesSource, existingDefaultOverride) {
        const property = this.e[propertyKey];
        const existingDefaultValue = existingDefaultOverride?.value ?? property?.defaultDefaultValue;
        let source = valuesSource;
        const isObjectSetting = $Bg(value) && (property !== void 0 && property.type === "object" || property === void 0 && ($Gg(existingDefaultValue) || $Bg(existingDefaultValue)));
        if (isObjectSetting) {
          source = existingDefaultOverride?.source ?? /* @__PURE__ */ new Map();
          if (!(source instanceof Map)) {
            console.error("defaultValueSource is not a Map");
            return void 0;
          }
          for (const objectKey in value) {
            if (valuesSource) {
              source.set(`${propertyKey}.${objectKey}`, valuesSource);
            }
          }
          value = { ...$Bg(existingDefaultValue) ? existingDefaultValue : {}, ...value };
        }
        return { value, source };
      }
      deltaConfiguration(delta) {
        let defaultsOverrides = false;
        const properties = /* @__PURE__ */ new Set();
        if (delta.removedDefaults) {
          this.m(delta.removedDefaults, properties);
          defaultsOverrides = true;
        }
        if (delta.addedDefaults) {
          this.l(delta.addedDefaults, properties);
          defaultsOverrides = true;
        }
        if (delta.removedConfigurations) {
          this.s(delta.removedConfigurations, properties);
        }
        if (delta.addedConfigurations) {
          this.r(delta.addedConfigurations, false, properties);
        }
        this.j.fire();
        this.k.fire({ properties, defaultsOverrides });
      }
      notifyConfigurationSchemaUpdated(...configurations) {
        this.j.fire();
      }
      registerOverrideIdentifiers(overrideIdentifiers) {
        this.q(overrideIdentifiers);
        this.j.fire();
      }
      q(overrideIdentifiers) {
        for (const overrideIdentifier of overrideIdentifiers) {
          this.i.add(overrideIdentifier);
        }
        this.y();
      }
      r(configurations, validate, bucket) {
        configurations.forEach((configuration) => {
          this.u(configuration, validate, configuration.extensionInfo, configuration.restrictedProperties, void 0, bucket);
          this.d.push(configuration);
          this.v(configuration);
        });
      }
      s(configurations, bucket) {
        const deregisterConfiguration = (configuration) => {
          if (configuration.properties) {
            for (const key in configuration.properties) {
              bucket.add(key);
              const property = this.e[key];
              if (property?.policy?.name) {
                this.f.delete(property.policy.name);
              }
              delete this.e[key];
              this.x(key, configuration.properties[key]);
            }
          }
          configuration.allOf?.forEach((node) => deregisterConfiguration(node));
        };
        for (const configuration of configurations) {
          deregisterConfiguration(configuration);
          const index = this.d.indexOf(configuration);
          if (index !== -1) {
            this.d.splice(index, 1);
          }
        }
      }
      u(configuration, validate = true, extensionInfo, restrictedProperties, scope = 3, bucket) {
        scope = $Ig(configuration.scope) ? scope : configuration.scope;
        const properties = configuration.properties;
        if (properties) {
          for (const key in properties) {
            const property = properties[key];
            if (validate && $Vt(key, property)) {
              delete properties[key];
              continue;
            }
            property.source = extensionInfo;
            property.defaultDefaultValue = properties[key].default;
            this.A(key, property);
            if ($Rt.test(key)) {
              property.scope = void 0;
            } else {
              property.scope = $Ig(property.scope) ? scope : property.scope;
              property.restricted = $Ig(property.restricted) ? !!restrictedProperties?.includes(key) : property.restricted;
            }
            if (properties[key].hasOwnProperty("included") && !properties[key].included) {
              this.g[key] = properties[key];
              delete properties[key];
              continue;
            } else {
              this.e[key] = properties[key];
              if (properties[key].policy?.name) {
                this.f.set(properties[key].policy.name, key);
              }
            }
            if (!properties[key].deprecationMessage && properties[key].markdownDeprecationMessage) {
              properties[key].deprecationMessage = properties[key].markdownDeprecationMessage;
            }
            bucket.add(key);
          }
        }
        const subNodes = configuration.allOf;
        if (subNodes) {
          for (const node of subNodes) {
            this.u(node, validate, extensionInfo, restrictedProperties, scope, bucket);
          }
        }
      }
      // TODO: @sandy081 - Remove this method and include required info in getConfigurationProperties
      getConfigurations() {
        return this.d;
      }
      getConfigurationProperties() {
        return this.e;
      }
      getPolicyConfigurations() {
        return this.f;
      }
      getExcludedConfigurationProperties() {
        return this.g;
      }
      getRegisteredDefaultConfigurations() {
        return [...this.a];
      }
      getConfigurationDefaultsOverrides() {
        const configurationDefaultsOverrides = /* @__PURE__ */ new Map();
        for (const [key, value] of this.b) {
          if (value.configurationDefaultOverrideValue) {
            configurationDefaultsOverrides.set(key, value.configurationDefaultOverrideValue);
          }
        }
        return configurationDefaultsOverrides;
      }
      v(configuration) {
        const register2 = (configuration2) => {
          const properties = configuration2.properties;
          if (properties) {
            for (const key in properties) {
              this.w(key, properties[key]);
            }
          }
          const subNodes = configuration2.allOf;
          subNodes?.forEach(register2);
        };
        register2(configuration);
      }
      w(key, property) {
        $It.properties[key] = property;
        switch (property.scope) {
          case 1:
            $Jt.properties[key] = property;
            break;
          case 2:
            $Kt.properties[key] = property;
            break;
          case 6:
            $Lt.properties[key] = property;
            break;
          case 3:
            $Mt.properties[key] = property;
            break;
          case 4:
            $Nt.properties[key] = property;
            break;
          case 5:
            $Nt.properties[key] = property;
            this.h.properties[key] = property;
            break;
        }
      }
      x(key, property) {
        delete $It.properties[key];
        switch (property.scope) {
          case 1:
            delete $Jt.properties[key];
            break;
          case 2:
            delete $Kt.properties[key];
            break;
          case 6:
            delete $Lt.properties[key];
            break;
          case 3:
            delete $Mt.properties[key];
            break;
          case 4:
          case 5:
            delete $Nt.properties[key];
            delete this.h.properties[key];
            break;
        }
      }
      y() {
        for (const overrideIdentifier of this.i.values()) {
          const overrideIdentifierProperty = `[${overrideIdentifier}]`;
          const resourceLanguagePropertiesSchema = {
            type: "object",
            description: localize(1695, null),
            errorMessage: localize(1696, null),
            $ref: $Ot
          };
          this.A(overrideIdentifierProperty, resourceLanguagePropertiesSchema);
          $It.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
          $Jt.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
          $Kt.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
          $Lt.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
          $Mt.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
          $Nt.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
        }
      }
      z() {
        const resourceLanguagePropertiesSchema = {
          type: "object",
          description: localize(1697, null),
          errorMessage: localize(1698, null),
          $ref: $Ot
        };
        $It.patternProperties[$Qt] = resourceLanguagePropertiesSchema;
        $Jt.patternProperties[$Qt] = resourceLanguagePropertiesSchema;
        $Kt.patternProperties[$Qt] = resourceLanguagePropertiesSchema;
        $Lt.patternProperties[$Qt] = resourceLanguagePropertiesSchema;
        $Mt.patternProperties[$Qt] = resourceLanguagePropertiesSchema;
        $Nt.patternProperties[$Qt] = resourceLanguagePropertiesSchema;
        this.j.fire();
      }
      A(key, property) {
        const configurationdefaultOverride = this.b.get(key)?.configurationDefaultOverrideValue;
        let defaultValue = void 0;
        let defaultSource = void 0;
        if (configurationdefaultOverride && (!property.disallowConfigurationDefault || !configurationdefaultOverride.source)) {
          defaultValue = configurationdefaultOverride.value;
          defaultSource = configurationdefaultOverride.source;
        }
        if ($Gg(defaultValue)) {
          defaultValue = property.defaultDefaultValue;
          defaultSource = void 0;
        }
        if ($Gg(defaultValue)) {
          defaultValue = $Ut(property.type);
        }
        property.default = defaultValue;
        property.defaultValueSource = defaultSource;
      }
    };
    OVERRIDE_IDENTIFIER_PATTERN = `\\[([^\\]]+)\\]`;
    OVERRIDE_IDENTIFIER_REGEX = new RegExp(OVERRIDE_IDENTIFIER_PATTERN, "g");
    $Qt = `^(${OVERRIDE_IDENTIFIER_PATTERN})+$`;
    $Rt = new RegExp($Qt);
    configurationRegistry = new ConfigurationRegistry();
    $Wn.add($Ht.Configuration, configurationRegistry);
  }
});

// out-build/vs/platform/configuration/common/configurationModels.js
function freeze(data) {
  return Object.isFrozen(data) ? data : $Mv(data);
}
function compare(from, to) {
  const { added, removed, updated } = compareConfigurationContents(to?.rawConfiguration, from?.rawConfiguration);
  const overrides = [];
  const fromOverrideIdentifiers = from?.getAllOverrideIdentifiers() || [];
  const toOverrideIdentifiers = to?.getAllOverrideIdentifiers() || [];
  if (to) {
    const addedOverrideIdentifiers = toOverrideIdentifiers.filter((key) => !fromOverrideIdentifiers.includes(key));
    for (const identifier of addedOverrideIdentifiers) {
      overrides.push([identifier, to.getKeysForOverrideIdentifier(identifier)]);
    }
  }
  if (from) {
    const removedOverrideIdentifiers = fromOverrideIdentifiers.filter((key) => !toOverrideIdentifiers.includes(key));
    for (const identifier of removedOverrideIdentifiers) {
      overrides.push([identifier, from.getKeysForOverrideIdentifier(identifier)]);
    }
  }
  if (to && from) {
    for (const identifier of fromOverrideIdentifiers) {
      if (toOverrideIdentifiers.includes(identifier)) {
        const result = compareConfigurationContents({ contents: from.getOverrideValue(void 0, identifier) || {}, keys: from.getKeysForOverrideIdentifier(identifier) }, { contents: to.getOverrideValue(void 0, identifier) || {}, keys: to.getKeysForOverrideIdentifier(identifier) });
        overrides.push([identifier, [...result.added, ...result.removed, ...result.updated]]);
      }
    }
  }
  return { added, removed, updated, overrides };
}
function compareConfigurationContents(to, from) {
  const added = to ? from ? to.keys.filter((key) => from.keys.indexOf(key) === -1) : [...to.keys] : [];
  const removed = from ? to ? from.keys.filter((key) => to.keys.indexOf(key) === -1) : [...from.keys] : [];
  const updated = [];
  if (to && from) {
    for (const key of from.keys) {
      if (to.keys.indexOf(key) !== -1) {
        const value1 = $sl(from.contents, key);
        const value2 = $sl(to.contents, key);
        if (!$Pv(value1, value2)) {
          updated.push(key);
        }
      }
    }
  }
  return { added, removed, updated };
}
var $SB, $TB, $UB, ConfigurationInspectValue, $VB, $XB;
var init_configurationModels = __esm({
  "out-build/vs/platform/configuration/common/configurationModels.js"() {
    "use strict";
    init_arrays();
    init_event();
    init_json();
    init_lifecycle();
    init_map();
    init_objects();
    init_types();
    init_uri();
    init_configuration();
    init_configurationRegistry();
    init_platform2();
    $SB = class _$SB {
      static createEmptyModel(logService) {
        return new _$SB({}, [], [], void 0, logService);
      }
      constructor(b, c, d, raw, f) {
        this.b = b;
        this.c = c;
        this.d = d;
        this.raw = raw;
        this.f = f;
        this.a = /* @__PURE__ */ new Map();
      }
      get rawConfiguration() {
        if (!this.g) {
          if (this.raw?.length) {
            const rawConfigurationModels = this.raw.map((raw) => {
              if (raw instanceof _$SB) {
                return raw;
              }
              const parser2 = new $TB("", this.f);
              parser2.parseRaw(raw);
              return parser2.configurationModel;
            });
            this.g = rawConfigurationModels.reduce((previous, current) => current === previous ? current : previous.merge(current), rawConfigurationModels[0]);
          } else {
            this.g = this;
          }
        }
        return this.g;
      }
      get contents() {
        return this.b;
      }
      get overrides() {
        return this.d;
      }
      get keys() {
        return this.c;
      }
      isEmpty() {
        return this.c.length === 0 && Object.keys(this.b).length === 0 && this.d.length === 0;
      }
      getValue(section) {
        return section ? $sl(this.contents, section) : this.contents;
      }
      inspect(section, overrideIdentifier) {
        const that = this;
        return {
          get value() {
            return freeze(that.rawConfiguration.getValue(section));
          },
          get override() {
            return overrideIdentifier ? freeze(that.rawConfiguration.getOverrideValue(section, overrideIdentifier)) : void 0;
          },
          get merged() {
            return freeze(overrideIdentifier ? that.rawConfiguration.override(overrideIdentifier).getValue(section) : that.rawConfiguration.getValue(section));
          },
          get overrides() {
            const overrides = [];
            for (const { contents, identifiers: identifiers2, keys } of that.rawConfiguration.overrides) {
              const value = new _$SB(contents, keys, [], void 0, that.f).getValue(section);
              if (value !== void 0) {
                overrides.push({ identifiers: identifiers2, value });
              }
            }
            return overrides.length ? freeze(overrides) : void 0;
          }
        };
      }
      getOverrideValue(section, overrideIdentifier) {
        const overrideContents = this.j(overrideIdentifier);
        return overrideContents ? section ? $sl(overrideContents, section) : overrideContents : void 0;
      }
      getKeysForOverrideIdentifier(identifier) {
        const keys = [];
        for (const override of this.overrides) {
          if (override.identifiers.includes(identifier)) {
            keys.push(...override.keys);
          }
        }
        return $Rb(keys);
      }
      getAllOverrideIdentifiers() {
        const result = [];
        for (const override of this.overrides) {
          result.push(...override.identifiers);
        }
        return $Rb(result);
      }
      override(identifier) {
        let overrideConfigurationModel = this.a.get(identifier);
        if (!overrideConfigurationModel) {
          overrideConfigurationModel = this.h(identifier);
          this.a.set(identifier, overrideConfigurationModel);
        }
        return overrideConfigurationModel;
      }
      merge(...others) {
        const contents = $Lv(this.contents);
        const overrides = $Lv(this.overrides);
        const keys = [...this.keys];
        const raws = this.raw?.length ? [...this.raw] : [this];
        for (const other of others) {
          raws.push(...other.raw?.length ? other.raw : [other]);
          if (other.isEmpty()) {
            continue;
          }
          this.i(contents, other.contents);
          for (const otherOverride of other.overrides) {
            const [override] = overrides.filter((o) => $zb(o.identifiers, otherOverride.identifiers));
            if (override) {
              this.i(override.contents, otherOverride.contents);
              override.keys.push(...otherOverride.keys);
              override.keys = $Rb(override.keys);
            } else {
              overrides.push($Lv(otherOverride));
            }
          }
          for (const key of other.keys) {
            if (keys.indexOf(key) === -1) {
              keys.push(key);
            }
          }
        }
        return new _$SB(contents, keys, overrides, raws.every((raw) => raw instanceof _$SB) ? void 0 : raws, this.f);
      }
      h(identifier) {
        const overrideContents = this.j(identifier);
        if (!overrideContents || typeof overrideContents !== "object" || !Object.keys(overrideContents).length) {
          return this;
        }
        const contents = {};
        for (const key of $Rb([...Object.keys(this.contents), ...Object.keys(overrideContents)])) {
          let contentsForKey = this.contents[key];
          const overrideContentsForKey = overrideContents[key];
          if (overrideContentsForKey) {
            if (typeof contentsForKey === "object" && typeof overrideContentsForKey === "object") {
              contentsForKey = $Lv(contentsForKey);
              this.i(contentsForKey, overrideContentsForKey);
            } else {
              contentsForKey = overrideContentsForKey;
            }
          }
          contents[key] = contentsForKey;
        }
        return new _$SB(contents, this.keys, this.overrides, void 0, this.f);
      }
      i(source, target) {
        for (const key of Object.keys(target)) {
          if (key in source) {
            if ($Bg(source[key]) && $Bg(target[key])) {
              this.i(source[key], target[key]);
              continue;
            }
          }
          source[key] = $Lv(target[key]);
        }
      }
      j(identifier) {
        let contentsForIdentifierOnly = null;
        let contents = null;
        const mergeContents = (contentsToMerge) => {
          if (contentsToMerge) {
            if (contents) {
              this.i(contents, contentsToMerge);
            } else {
              contents = $Lv(contentsToMerge);
            }
          }
        };
        for (const override of this.overrides) {
          if (override.identifiers.length === 1 && override.identifiers[0] === identifier) {
            contentsForIdentifierOnly = override.contents;
          } else if (override.identifiers.includes(identifier)) {
            mergeContents(override.contents);
          }
        }
        mergeContents(contentsForIdentifierOnly);
        return contents;
      }
      toJSON() {
        return {
          contents: this.contents,
          overrides: this.overrides,
          keys: this.keys
        };
      }
      // Update methods
      addValue(key, value) {
        this.k(key, value, true);
      }
      setValue(key, value) {
        this.k(key, value, false);
      }
      removeValue(key) {
        const index = this.keys.indexOf(key);
        if (index === -1) {
          return;
        }
        this.keys.splice(index, 1);
        $rl(this.contents, key);
        if ($Rt.test(key)) {
          this.overrides.splice(this.overrides.findIndex((o) => $zb(o.identifiers, $St(key))), 1);
        }
      }
      k(key, value, add) {
        $ql(this.contents, key, value, (e) => this.f.error(e));
        add = add || this.keys.indexOf(key) === -1;
        if (add) {
          this.keys.push(key);
        }
        if ($Rt.test(key)) {
          const identifiers2 = $St(key);
          const override = {
            identifiers: identifiers2,
            keys: Object.keys(this.contents[key]),
            contents: $pl(this.contents[key], (message) => this.f.error(message))
          };
          const index = this.overrides.findIndex((o) => $zb(o.identifiers, identifiers2));
          if (index !== -1) {
            this.overrides[index] = override;
          } else {
            this.overrides.push(override);
          }
        }
      }
    };
    $TB = class {
      constructor(f, g) {
        this.f = f;
        this.g = g;
        this.a = null;
        this.b = null;
        this.c = [];
        this.d = [];
      }
      get configurationModel() {
        return this.b || $SB.createEmptyModel(this.g);
      }
      get restrictedConfigurations() {
        return this.c;
      }
      get errors() {
        return this.d;
      }
      parse(content, options2) {
        if (!$Ig(content)) {
          const raw = this.h(content);
          this.parseRaw(raw, options2);
        }
      }
      reparse(options2) {
        if (this.a) {
          this.parseRaw(this.a, options2);
        }
      }
      parseRaw(raw, options2) {
        this.a = raw;
        const { contents, keys, overrides, restricted, hasExcludedProperties } = this.i(raw, options2);
        this.b = new $SB(contents, keys, overrides, hasExcludedProperties ? [raw] : void 0, this.g);
        this.c = restricted || [];
      }
      h(content) {
        let raw = {};
        let currentProperty = null;
        let currentParent = [];
        const previousParents = [];
        const parseErrors = [];
        function onValue(value) {
          if (Array.isArray(currentParent)) {
            currentParent.push(value);
          } else if (currentProperty !== null) {
            currentParent[currentProperty] = value;
          }
        }
        const visitor = {
          onObjectBegin: () => {
            const object = {};
            onValue(object);
            previousParents.push(currentParent);
            currentParent = object;
            currentProperty = null;
          },
          onObjectProperty: (name) => {
            currentProperty = name;
          },
          onObjectEnd: () => {
            currentParent = previousParents.pop();
          },
          onArrayBegin: () => {
            const array = [];
            onValue(array);
            previousParents.push(currentParent);
            currentParent = array;
            currentProperty = null;
          },
          onArrayEnd: () => {
            currentParent = previousParents.pop();
          },
          onLiteralValue: onValue,
          onError: (error, offset, length) => {
            parseErrors.push({ error, offset, length });
          }
        };
        if (content) {
          try {
            $Fw(content, visitor);
            raw = currentParent[0] || {};
          } catch (e) {
            this.g.error(`Error while parsing settings file ${this.f}: ${e}`);
            this.d = [e];
          }
        }
        return raw;
      }
      i(raw, options2) {
        const configurationProperties = $Wn.as($Ht.Configuration).getConfigurationProperties();
        const filtered = this.j(raw, configurationProperties, true, options2);
        raw = filtered.raw;
        const contents = $pl(raw, (message) => this.g.error(`Conflict in settings file ${this.f}: ${message}`));
        const keys = Object.keys(raw);
        const overrides = this.m(raw, (message) => this.g.error(`Conflict in settings file ${this.f}: ${message}`));
        return { contents, keys, overrides, restricted: filtered.restricted, hasExcludedProperties: filtered.hasExcludedProperties };
      }
      j(properties, configurationProperties, filterOverriddenProperties, options2) {
        let hasExcludedProperties = false;
        if (!options2?.scopes && !options2?.skipRestricted && !options2?.exclude?.length) {
          return { raw: properties, restricted: [], hasExcludedProperties };
        }
        const raw = {};
        const restricted = [];
        for (const key in properties) {
          if ($Rt.test(key) && filterOverriddenProperties) {
            const result = this.j(properties[key], configurationProperties, false, options2);
            raw[key] = result.raw;
            hasExcludedProperties = hasExcludedProperties || result.hasExcludedProperties;
            restricted.push(...result.restricted);
          } else {
            const propertySchema = configurationProperties[key];
            if (propertySchema?.restricted) {
              restricted.push(key);
            }
            if (this.l(key, propertySchema, options2)) {
              raw[key] = properties[key];
            } else {
              hasExcludedProperties = true;
            }
          }
        }
        return { raw, restricted, hasExcludedProperties };
      }
      l(key, propertySchema, options2) {
        if (options2.exclude?.includes(key)) {
          return false;
        }
        if (options2.include?.includes(key)) {
          return true;
        }
        if (options2.skipRestricted && propertySchema?.restricted) {
          return false;
        }
        if (options2.skipUnregistered && !propertySchema) {
          return false;
        }
        const scope = propertySchema ? typeof propertySchema.scope !== "undefined" ? propertySchema.scope : 3 : void 0;
        if (scope === void 0 || options2.scopes === void 0) {
          return true;
        }
        return options2.scopes.includes(scope);
      }
      m(raw, conflictReporter) {
        const overrides = [];
        for (const key of Object.keys(raw)) {
          if ($Rt.test(key)) {
            const overrideRaw = {};
            for (const keyInOverrideRaw in raw[key]) {
              overrideRaw[keyInOverrideRaw] = raw[key][keyInOverrideRaw];
            }
            overrides.push({
              identifiers: $St(key),
              keys: Object.keys(overrideRaw),
              contents: $pl(overrideRaw, conflictReporter)
            });
          }
        }
        return overrides;
      }
    };
    $UB = class extends $3c {
      constructor(c, f, extUri, g, h) {
        super();
        this.c = c;
        this.f = f;
        this.g = g;
        this.h = h;
        this.b = this.B(new $ze());
        this.onDidChange = this.b.event;
        this.a = new $TB(this.c.toString(), h);
        this.B(this.g.watch(extUri.dirname(this.c)));
        this.B(this.g.watch(this.c));
        this.B(Event.any(Event.filter(this.g.onDidFilesChange, (e) => e.contains(this.c)), Event.filter(this.g.onDidRunOperation, (e) => (e.isOperation(
          0
          /* FileOperation.CREATE */
        ) || e.isOperation(
          3
          /* FileOperation.COPY */
        ) || e.isOperation(
          1
          /* FileOperation.DELETE */
        ) || e.isOperation(
          4
          /* FileOperation.WRITE */
        )) && extUri.isEqual(e.resource, c)))(() => this.b.fire()));
      }
      async loadConfiguration() {
        try {
          const content = await this.g.readFile(this.c);
          this.a.parse(content.value.toString() || "{}", this.f);
          return this.a.configurationModel;
        } catch (e) {
          return $SB.createEmptyModel(this.h);
        }
      }
      reparse(parseOptions) {
        if (parseOptions) {
          this.f = parseOptions;
        }
        this.a.reparse(this.f);
        return this.a.configurationModel;
      }
      getRestrictedSettings() {
        return this.a.restrictedConfigurations;
      }
    };
    ConfigurationInspectValue = class {
      constructor(a, b, c, overrideIdentifiers, d, f, g, h, i, j, k, l, m) {
        this.a = a;
        this.b = b;
        this.c = c;
        this.overrideIdentifiers = overrideIdentifiers;
        this.d = d;
        this.f = f;
        this.g = g;
        this.h = h;
        this.i = i;
        this.j = j;
        this.k = k;
        this.l = l;
        this.m = m;
      }
      get value() {
        return freeze(this.c);
      }
      n(inspectValue) {
        return inspectValue?.value !== void 0 || inspectValue?.override !== void 0 || inspectValue?.overrides !== void 0 ? inspectValue : void 0;
      }
      get q() {
        if (!this.p) {
          this.p = this.d.inspect(this.a, this.b.overrideIdentifier);
        }
        return this.p;
      }
      get defaultValue() {
        return this.q.merged;
      }
      get default() {
        return this.n(this.q);
      }
      get s() {
        if (this.r === void 0) {
          this.r = this.f ? this.f.inspect(this.a) : null;
        }
        return this.r;
      }
      get policyValue() {
        return this.s?.merged;
      }
      get policy() {
        return this.s?.value !== void 0 ? { value: this.s.value } : void 0;
      }
      get u() {
        if (this.t === void 0) {
          this.t = this.g ? this.g.inspect(this.a) : null;
        }
        return this.t;
      }
      get applicationValue() {
        return this.u?.merged;
      }
      get application() {
        return this.n(this.u);
      }
      get w() {
        if (!this.v) {
          this.v = this.h.inspect(this.a, this.b.overrideIdentifier);
        }
        return this.v;
      }
      get userValue() {
        return this.w.merged;
      }
      get user() {
        return this.n(this.w);
      }
      get y() {
        if (!this.x) {
          this.x = this.i.inspect(this.a, this.b.overrideIdentifier);
        }
        return this.x;
      }
      get userLocalValue() {
        return this.y.merged;
      }
      get userLocal() {
        return this.n(this.y);
      }
      get A() {
        if (!this.z) {
          this.z = this.j.inspect(this.a, this.b.overrideIdentifier);
        }
        return this.z;
      }
      get userRemoteValue() {
        return this.A.merged;
      }
      get userRemote() {
        return this.n(this.A);
      }
      get D() {
        if (this.B === void 0) {
          this.B = this.k ? this.k.inspect(this.a, this.b.overrideIdentifier) : null;
        }
        return this.B;
      }
      get workspaceValue() {
        return this.D?.merged;
      }
      get workspace() {
        return this.n(this.D);
      }
      get F() {
        if (this.E === void 0) {
          this.E = this.l ? this.l.inspect(this.a, this.b.overrideIdentifier) : null;
        }
        return this.E;
      }
      get workspaceFolderValue() {
        return this.F?.merged;
      }
      get workspaceFolder() {
        return this.n(this.F);
      }
      get H() {
        if (this.G === void 0) {
          this.G = this.m.inspect(this.a, this.b.overrideIdentifier);
        }
        return this.G;
      }
      get memoryValue() {
        return this.H.merged;
      }
      get memory() {
        return this.n(this.H);
      }
    };
    $VB = class _$VB {
      constructor(j, l, m, n, p, q, r, s, t, u) {
        this.j = j;
        this.l = l;
        this.m = m;
        this.n = n;
        this.p = p;
        this.q = q;
        this.r = r;
        this.s = s;
        this.t = t;
        this.u = u;
        this.h = null;
        this.i = new $Ec();
        this.v = null;
      }
      getValue(section, overrides, workspace) {
        const consolidateConfigurationModel = this.w(section, overrides, workspace);
        return consolidateConfigurationModel.getValue(section);
      }
      updateValue(key, value, overrides = {}) {
        let memoryConfiguration;
        if (overrides.resource) {
          memoryConfiguration = this.t.get(overrides.resource);
          if (!memoryConfiguration) {
            memoryConfiguration = $SB.createEmptyModel(this.u);
            this.t.set(overrides.resource, memoryConfiguration);
          }
        } else {
          memoryConfiguration = this.s;
        }
        if (value === void 0) {
          memoryConfiguration.removeValue(key);
        } else {
          memoryConfiguration.setValue(key, value);
        }
        if (!overrides.resource) {
          this.h = null;
        }
      }
      inspect(key, overrides, workspace) {
        const consolidateConfigurationModel = this.w(key, overrides, workspace);
        const folderConfigurationModel = this.A(overrides.resource, workspace);
        const memoryConfigurationModel = overrides.resource ? this.t.get(overrides.resource) || this.s : this.s;
        const overrideIdentifiers = /* @__PURE__ */ new Set();
        for (const override of consolidateConfigurationModel.overrides) {
          for (const overrideIdentifier of override.identifiers) {
            if (consolidateConfigurationModel.getOverrideValue(key, overrideIdentifier) !== void 0) {
              overrideIdentifiers.add(overrideIdentifier);
            }
          }
        }
        return new ConfigurationInspectValue(key, overrides, consolidateConfigurationModel.getValue(key), overrideIdentifiers.size ? [...overrideIdentifiers] : void 0, this.j, this.l.isEmpty() ? void 0 : this.l, this.applicationConfiguration.isEmpty() ? void 0 : this.applicationConfiguration, this.userConfiguration, this.localUserConfiguration, this.remoteUserConfiguration, workspace ? this.q : void 0, folderConfigurationModel ? folderConfigurationModel : void 0, memoryConfigurationModel);
      }
      keys(workspace) {
        const folderConfigurationModel = this.A(void 0, workspace);
        return {
          default: this.j.keys.slice(0),
          user: this.userConfiguration.keys.slice(0),
          workspace: this.q.keys.slice(0),
          workspaceFolder: folderConfigurationModel ? folderConfigurationModel.keys.slice(0) : []
        };
      }
      updateDefaultConfiguration(defaultConfiguration) {
        this.j = defaultConfiguration;
        this.h = null;
        this.i.clear();
      }
      updatePolicyConfiguration(policyConfiguration) {
        this.l = policyConfiguration;
      }
      updateApplicationConfiguration(applicationConfiguration) {
        this.m = applicationConfiguration;
        this.h = null;
        this.i.clear();
      }
      updateLocalUserConfiguration(localUserConfiguration) {
        this.n = localUserConfiguration;
        this.v = null;
        this.h = null;
        this.i.clear();
      }
      updateRemoteUserConfiguration(remoteUserConfiguration) {
        this.p = remoteUserConfiguration;
        this.v = null;
        this.h = null;
        this.i.clear();
      }
      updateWorkspaceConfiguration(workspaceConfiguration) {
        this.q = workspaceConfiguration;
        this.h = null;
        this.i.clear();
      }
      updateFolderConfiguration(resource, configuration) {
        this.r.set(resource, configuration);
        this.i.delete(resource);
      }
      deleteFolderConfiguration(resource) {
        this.folderConfigurations.delete(resource);
        this.i.delete(resource);
      }
      compareAndUpdateDefaultConfiguration(defaults, keys) {
        const overrides = [];
        if (!keys) {
          const { added, updated, removed } = compare(this.j, defaults);
          keys = [...added, ...updated, ...removed];
        }
        for (const key of keys) {
          for (const overrideIdentifier of $St(key)) {
            const fromKeys = this.j.getKeysForOverrideIdentifier(overrideIdentifier);
            const toKeys = defaults.getKeysForOverrideIdentifier(overrideIdentifier);
            const keys2 = [
              ...toKeys.filter((key2) => fromKeys.indexOf(key2) === -1),
              ...fromKeys.filter((key2) => toKeys.indexOf(key2) === -1),
              ...fromKeys.filter((key2) => !$Pv(this.j.override(overrideIdentifier).getValue(key2), defaults.override(overrideIdentifier).getValue(key2)))
            ];
            overrides.push([overrideIdentifier, keys2]);
          }
        }
        this.updateDefaultConfiguration(defaults);
        return { keys, overrides };
      }
      compareAndUpdatePolicyConfiguration(policyConfiguration) {
        const { added, updated, removed } = compare(this.l, policyConfiguration);
        const keys = [...added, ...updated, ...removed];
        if (keys.length) {
          this.updatePolicyConfiguration(policyConfiguration);
        }
        return { keys, overrides: [] };
      }
      compareAndUpdateApplicationConfiguration(application) {
        const { added, updated, removed, overrides } = compare(this.applicationConfiguration, application);
        const keys = [...added, ...updated, ...removed];
        if (keys.length) {
          this.updateApplicationConfiguration(application);
        }
        return { keys, overrides };
      }
      compareAndUpdateLocalUserConfiguration(user) {
        const { added, updated, removed, overrides } = compare(this.localUserConfiguration, user);
        const keys = [...added, ...updated, ...removed];
        if (keys.length) {
          this.updateLocalUserConfiguration(user);
        }
        return { keys, overrides };
      }
      compareAndUpdateRemoteUserConfiguration(user) {
        const { added, updated, removed, overrides } = compare(this.remoteUserConfiguration, user);
        const keys = [...added, ...updated, ...removed];
        if (keys.length) {
          this.updateRemoteUserConfiguration(user);
        }
        return { keys, overrides };
      }
      compareAndUpdateWorkspaceConfiguration(workspaceConfiguration) {
        const { added, updated, removed, overrides } = compare(this.workspaceConfiguration, workspaceConfiguration);
        const keys = [...added, ...updated, ...removed];
        if (keys.length) {
          this.updateWorkspaceConfiguration(workspaceConfiguration);
        }
        return { keys, overrides };
      }
      compareAndUpdateFolderConfiguration(resource, folderConfiguration) {
        const currentFolderConfiguration = this.folderConfigurations.get(resource);
        const { added, updated, removed, overrides } = compare(currentFolderConfiguration, folderConfiguration);
        const keys = [...added, ...updated, ...removed];
        if (keys.length || !currentFolderConfiguration) {
          this.updateFolderConfiguration(resource, folderConfiguration);
        }
        return { keys, overrides };
      }
      compareAndDeleteFolderConfiguration(folder) {
        const folderConfig = this.folderConfigurations.get(folder);
        if (!folderConfig) {
          throw new Error("Unknown folder");
        }
        this.deleteFolderConfiguration(folder);
        const { added, updated, removed, overrides } = compare(folderConfig, void 0);
        return { keys: [...added, ...updated, ...removed], overrides };
      }
      get defaults() {
        return this.j;
      }
      get applicationConfiguration() {
        return this.m;
      }
      get userConfiguration() {
        if (!this.v) {
          this.v = this.p.isEmpty() ? this.n : this.n.merge(this.p);
        }
        return this.v;
      }
      get localUserConfiguration() {
        return this.n;
      }
      get remoteUserConfiguration() {
        return this.p;
      }
      get workspaceConfiguration() {
        return this.q;
      }
      get folderConfigurations() {
        return this.r;
      }
      w(section, overrides, workspace) {
        let configurationModel = this.x(overrides, workspace);
        if (overrides.overrideIdentifier) {
          configurationModel = configurationModel.override(overrides.overrideIdentifier);
        }
        if (!this.l.isEmpty() && this.l.getValue(section) !== void 0) {
          configurationModel = configurationModel.merge(this.l);
        }
        return configurationModel;
      }
      x({ resource }, workspace) {
        let consolidateConfiguration = this.y();
        if (workspace && resource) {
          const root = workspace.getFolder(resource);
          if (root) {
            consolidateConfiguration = this.z(root.uri) || consolidateConfiguration;
          }
          const memoryConfigurationForResource = this.t.get(resource);
          if (memoryConfigurationForResource) {
            consolidateConfiguration = consolidateConfiguration.merge(memoryConfigurationForResource);
          }
        }
        return consolidateConfiguration;
      }
      y() {
        if (!this.h) {
          this.h = this.j.merge(this.applicationConfiguration, this.userConfiguration, this.q, this.s);
        }
        return this.h;
      }
      z(folder) {
        let folderConsolidatedConfiguration = this.i.get(folder);
        if (!folderConsolidatedConfiguration) {
          const workspaceConsolidateConfiguration = this.y();
          const folderConfiguration = this.r.get(folder);
          if (folderConfiguration) {
            folderConsolidatedConfiguration = workspaceConsolidateConfiguration.merge(folderConfiguration);
            this.i.set(folder, folderConsolidatedConfiguration);
          } else {
            folderConsolidatedConfiguration = workspaceConsolidateConfiguration;
          }
        }
        return folderConsolidatedConfiguration;
      }
      A(resource, workspace) {
        if (workspace && resource) {
          const root = workspace.getFolder(resource);
          if (root) {
            return this.r.get(root.uri);
          }
        }
        return void 0;
      }
      toData() {
        return {
          defaults: {
            contents: this.j.contents,
            overrides: this.j.overrides,
            keys: this.j.keys
          },
          policy: {
            contents: this.l.contents,
            overrides: this.l.overrides,
            keys: this.l.keys
          },
          application: {
            contents: this.applicationConfiguration.contents,
            overrides: this.applicationConfiguration.overrides,
            keys: this.applicationConfiguration.keys
          },
          user: {
            contents: this.userConfiguration.contents,
            overrides: this.userConfiguration.overrides,
            keys: this.userConfiguration.keys
          },
          workspace: {
            contents: this.q.contents,
            overrides: this.q.overrides,
            keys: this.q.keys
          },
          folders: [...this.r.keys()].reduce((result, folder) => {
            const { contents, overrides, keys } = this.r.get(folder);
            result.push([folder, { contents, overrides, keys }]);
            return result;
          }, [])
        };
      }
      allKeys() {
        const keys = /* @__PURE__ */ new Set();
        this.j.keys.forEach((key) => keys.add(key));
        this.userConfiguration.keys.forEach((key) => keys.add(key));
        this.q.keys.forEach((key) => keys.add(key));
        this.r.forEach((folderConfiguration) => folderConfiguration.keys.forEach((key) => keys.add(key)));
        return [...keys.values()];
      }
      B() {
        const keys = /* @__PURE__ */ new Set();
        this.j.getAllOverrideIdentifiers().forEach((key) => keys.add(key));
        this.userConfiguration.getAllOverrideIdentifiers().forEach((key) => keys.add(key));
        this.q.getAllOverrideIdentifiers().forEach((key) => keys.add(key));
        this.r.forEach((folderConfiguration) => folderConfiguration.getAllOverrideIdentifiers().forEach((key) => keys.add(key)));
        return [...keys.values()];
      }
      D(overrideIdentifier) {
        const keys = /* @__PURE__ */ new Set();
        this.j.getKeysForOverrideIdentifier(overrideIdentifier).forEach((key) => keys.add(key));
        this.userConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach((key) => keys.add(key));
        this.q.getKeysForOverrideIdentifier(overrideIdentifier).forEach((key) => keys.add(key));
        this.r.forEach((folderConfiguration) => folderConfiguration.getKeysForOverrideIdentifier(overrideIdentifier).forEach((key) => keys.add(key)));
        return [...keys.values()];
      }
      static parse(data, logService) {
        const defaultConfiguration = this.E(data.defaults, logService);
        const policyConfiguration = this.E(data.policy, logService);
        const applicationConfiguration = this.E(data.application, logService);
        const userConfiguration = this.E(data.user, logService);
        const workspaceConfiguration = this.E(data.workspace, logService);
        const folders = data.folders.reduce((result, value) => {
          result.set(URI.revive(value[0]), this.E(value[1], logService));
          return result;
        }, new $Ec());
        return new _$VB(defaultConfiguration, policyConfiguration, applicationConfiguration, userConfiguration, $SB.createEmptyModel(logService), workspaceConfiguration, folders, $SB.createEmptyModel(logService), new $Ec(), logService);
      }
      static E(model, logService) {
        return new $SB(model.contents, model.keys, model.overrides, void 0, logService);
      }
    };
    $XB = class {
      constructor(change, f, g, h, i) {
        this.change = change;
        this.f = f;
        this.g = g;
        this.h = h;
        this.i = i;
        this.a = "\n";
        this.b = this.a.charCodeAt(0);
        this.c = ".".charCodeAt(0);
        this.affectedKeys = /* @__PURE__ */ new Set();
        this.j = void 0;
        for (const key of change.keys) {
          this.affectedKeys.add(key);
        }
        for (const [, keys] of change.overrides) {
          for (const key of keys) {
            this.affectedKeys.add(key);
          }
        }
        this.d = this.a;
        for (const key of this.affectedKeys) {
          this.d += key + this.a;
        }
      }
      get previousConfiguration() {
        if (!this.j && this.f) {
          this.j = $VB.parse(this.f.data, this.i);
        }
        return this.j;
      }
      affectsConfiguration(section, overrides) {
        const needle = this.a + section;
        const idx = this.d.indexOf(needle);
        if (idx < 0) {
          return false;
        }
        const pos = idx + needle.length;
        if (pos >= this.d.length) {
          return false;
        }
        const code = this.d.charCodeAt(pos);
        if (code !== this.b && code !== this.c) {
          return false;
        }
        if (overrides) {
          const value1 = this.previousConfiguration ? this.previousConfiguration.getValue(section, overrides, this.f?.workspace) : void 0;
          const value2 = this.g.getValue(section, overrides, this.h);
          return !$Pv(value1, value2);
        }
        return true;
      }
    };
  }
});

// out-build/vs/platform/policy/common/policy.js
var $Pn, $Rn;
var init_policy = __esm({
  "out-build/vs/platform/policy/common/policy.js"() {
    "use strict";
    init_event();
    init_iterator();
    init_lifecycle();
    init_instantiation();
    $Pn = $Qk("policy");
    $Rn = class {
      constructor() {
        this.onDidChange = Event.None;
      }
      async updatePolicyDefinitions() {
        return {};
      }
      getPolicyValue() {
        return void 0;
      }
      serialize() {
        return void 0;
      }
    };
  }
});

// out-build/vs/platform/configuration/common/configurations.js
var $YB, $ZB, $1B;
var init_configurations = __esm({
  "out-build/vs/platform/configuration/common/configurations.js"() {
    "use strict";
    init_arrays();
    init_event();
    init_lifecycle();
    init_objects();
    init_types();
    init_configurationModels();
    init_configurationRegistry();
    init_log();
    init_policy();
    init_platform2();
    init_errors();
    init_json();
    $YB = class extends $3c {
      get configurationModel() {
        return this.b;
      }
      constructor(c) {
        super();
        this.c = c;
        this.a = this.B(new $ze());
        this.onDidChangeConfiguration = this.a.event;
        this.b = $SB.createEmptyModel(this.c);
      }
      async initialize() {
        this.h();
        this.B($Wn.as($Ht.Configuration).onDidUpdateConfiguration(({ properties, defaultsOverrides }) => this.f(Array.from(properties), defaultsOverrides)));
        return this.configurationModel;
      }
      reload() {
        this.h();
        return this.configurationModel;
      }
      f(properties, defaultsOverrides) {
        this.j(properties, $Wn.as($Ht.Configuration).getConfigurationProperties());
        this.a.fire({ defaults: this.configurationModel, properties });
      }
      g() {
        return {};
      }
      h() {
        this.b = $SB.createEmptyModel(this.c);
        const properties = $Wn.as($Ht.Configuration).getConfigurationProperties();
        this.j(Object.keys(properties), properties);
      }
      j(properties, configurationProperties) {
        const configurationDefaultsOverrides = this.g();
        for (const key of properties) {
          const defaultOverrideValue = configurationDefaultsOverrides[key];
          const propertySchema = configurationProperties[key];
          if (defaultOverrideValue !== void 0) {
            this.b.setValue(key, defaultOverrideValue);
          } else if (propertySchema) {
            this.b.setValue(key, propertySchema.default);
          } else {
            this.b.removeValue(key);
          }
        }
      }
    };
    $ZB = class {
      constructor() {
        this.onDidChangeConfiguration = Event.None;
        this.configurationModel = $SB.createEmptyModel(new $Jn());
      }
      async initialize() {
        return this.configurationModel;
      }
    };
    $1B = class $1B2 extends $3c {
      get configurationModel() {
        return this.b;
      }
      constructor(c, f, g) {
        super();
        this.c = c;
        this.f = f;
        this.g = g;
        this.a = this.B(new $ze());
        this.onDidChangeConfiguration = this.a.event;
        this.b = $SB.createEmptyModel(this.g);
      }
      async initialize() {
        this.g.trace("PolicyConfiguration#initialize");
        this.m(await this.h(this.c.configurationModel.keys), false);
        this.B(this.f.onDidChange((policyNames) => this.j(policyNames)));
        this.B(this.c.onDidChangeConfiguration(async ({ properties }) => this.m(await this.h(properties), true)));
        return this.b;
      }
      async h(properties) {
        this.g.trace("PolicyConfiguration#updatePolicyDefinitions", properties);
        const policyDefinitions = {};
        const keys = [];
        const configurationProperties = $Wn.as($Ht.Configuration).getConfigurationProperties();
        for (const key of properties) {
          const config = configurationProperties[key];
          if (!config) {
            keys.push(key);
            continue;
          }
          if (config.policy) {
            if (config.type !== "string" && config.type !== "number" && config.type !== "array" && config.type !== "object") {
              this.g.warn(`Policy ${config.policy.name} has unsupported type ${config.type}`);
              continue;
            }
            keys.push(key);
            policyDefinitions[config.policy.name] = { type: config.type === "number" ? "number" : "string" };
          }
        }
        if (!$Mg(policyDefinitions)) {
          await this.f.updatePolicyDefinitions(policyDefinitions);
        }
        return keys;
      }
      j(policyNames) {
        this.g.trace("PolicyConfiguration#onDidChangePolicies", policyNames);
        const policyConfigurations = $Wn.as($Ht.Configuration).getPolicyConfigurations();
        const keys = $Mb(policyNames.map((policyName) => policyConfigurations.get(policyName)));
        this.m(keys, true);
      }
      m(keys, trigger) {
        this.g.trace("PolicyConfiguration#update", keys);
        const configurationProperties = $Wn.as($Ht.Configuration).getConfigurationProperties();
        const changed = [];
        const wasEmpty = this.b.isEmpty();
        for (const key of keys) {
          const proprety = configurationProperties[key];
          const policyName = proprety?.policy?.name;
          if (policyName) {
            let policyValue = this.f.getPolicyValue(policyName);
            if ($zg(policyValue) && proprety.type !== "string") {
              try {
                policyValue = this.n(policyValue);
              } catch (e) {
                this.g.error(`Error parsing policy value ${policyName}:`, $qb(e));
                continue;
              }
            }
            if (wasEmpty ? policyValue !== void 0 : !$Pv(this.b.getValue(key), policyValue)) {
              changed.push([key, policyValue]);
            }
          } else {
            if (this.b.getValue(key) !== void 0) {
              changed.push([key, void 0]);
            }
          }
        }
        if (changed.length) {
          this.g.trace("PolicyConfiguration#changed", changed);
          const old = this.b;
          this.b = $SB.createEmptyModel(this.g);
          for (const key of old.keys) {
            this.b.setValue(key, old.getValue(key));
          }
          for (const [key, policyValue] of changed) {
            if (policyValue === void 0) {
              this.b.removeValue(key);
            } else {
              this.b.setValue(key, policyValue);
            }
          }
          if (trigger) {
            this.a.fire(this.b);
          }
        }
      }
      n(content) {
        let raw = {};
        let currentProperty = null;
        let currentParent = [];
        const previousParents = [];
        const parseErrors = [];
        function onValue(value) {
          if (Array.isArray(currentParent)) {
            currentParent.push(value);
          } else if (currentProperty !== null) {
            if (currentParent[currentProperty] !== void 0) {
              throw new Error(`Duplicate property found: ${currentProperty}`);
            }
            currentParent[currentProperty] = value;
          }
        }
        const visitor = {
          onObjectBegin: () => {
            const object = {};
            onValue(object);
            previousParents.push(currentParent);
            currentParent = object;
            currentProperty = null;
          },
          onObjectProperty: (name) => {
            currentProperty = name;
          },
          onObjectEnd: () => {
            currentParent = previousParents.pop();
          },
          onArrayBegin: () => {
            const array = [];
            onValue(array);
            previousParents.push(currentParent);
            currentParent = array;
            currentProperty = null;
          },
          onArrayEnd: () => {
            currentParent = previousParents.pop();
          },
          onLiteralValue: onValue,
          onError: (error, offset, length) => {
            parseErrors.push({ error, offset, length });
          }
        };
        if (content) {
          $Fw(content, visitor);
          raw = currentParent[0] || {};
        }
        if (parseErrors.length > 0) {
          throw new Error(parseErrors.map((e) => $qb(e.error)).join("\n"));
        }
        return raw;
      }
    };
    $1B = __decorate([
      __param(1, $Pn),
      __param(2, $wn)
    ], $1B);
  }
});

// out-build/vs/platform/configuration/common/configurationService.js
var $2B, ConfigurationEditing;
var init_configurationService = __esm({
  "out-build/vs/platform/configuration/common/configurationService.js"() {
    "use strict";
    init_arrays();
    init_async();
    init_buffer();
    init_event();
    init_json();
    init_jsonEdit();
    init_lifecycle();
    init_map();
    init_objects();
    init_platform();
    init_resources();
    init_configuration();
    init_configurationModels();
    init_configurationRegistry();
    init_configurations();
    init_policy();
    $2B = class extends $3c {
      constructor(m, fileService, policyService, n) {
        super();
        this.m = m;
        this.n = n;
        this.h = this.B(new $ze());
        this.onDidChangeConfiguration = this.h.event;
        this.b = this.B(new $YB(n));
        this.c = policyService instanceof $Rn ? new $ZB() : this.B(new $1B(this.b, policyService, n));
        this.f = this.B(new $UB(this.m, {}, $mh, fileService, n));
        this.a = new $VB(this.b.configurationModel, this.c.configurationModel, $SB.createEmptyModel(n), $SB.createEmptyModel(n), $SB.createEmptyModel(n), $SB.createEmptyModel(n), new $Ec(), $SB.createEmptyModel(n), new $Ec(), n);
        this.j = new ConfigurationEditing(m, fileService, this);
        this.g = this.B(new $8h(() => this.reloadConfiguration(), 50));
        this.B(this.b.onDidChangeConfiguration(({ defaults, properties }) => this.s(defaults, properties)));
        this.B(this.c.onDidChangeConfiguration((model) => this.t(model)));
        this.B(this.f.onDidChange(() => this.g.schedule()));
      }
      async initialize() {
        const [defaultModel, policyModel, userModel] = await Promise.all([this.b.initialize(), this.c.initialize(), this.f.loadConfiguration()]);
        this.a = new $VB(defaultModel, policyModel, $SB.createEmptyModel(this.n), userModel, $SB.createEmptyModel(this.n), $SB.createEmptyModel(this.n), new $Ec(), $SB.createEmptyModel(this.n), new $Ec(), this.n);
      }
      getConfigurationData() {
        return this.a.toData();
      }
      getValue(arg1, arg2) {
        const section = typeof arg1 === "string" ? arg1 : void 0;
        const overrides = $ll(arg1) ? arg1 : $ll(arg2) ? arg2 : {};
        return this.a.getValue(section, overrides, void 0);
      }
      async updateValue(key, value, arg3, arg4, options2) {
        const overrides = $ml(arg3) ? arg3 : $ll(arg3) ? { resource: arg3.resource, overrideIdentifiers: arg3.overrideIdentifier ? [arg3.overrideIdentifier] : void 0 } : void 0;
        const target = overrides ? arg4 : arg3;
        if (target !== void 0) {
          if (target !== 3 && target !== 2) {
            throw new Error(`Unable to write ${key} to target ${target}.`);
          }
        }
        if (overrides?.overrideIdentifiers) {
          overrides.overrideIdentifiers = $Rb(overrides.overrideIdentifiers);
          overrides.overrideIdentifiers = overrides.overrideIdentifiers.length ? overrides.overrideIdentifiers : void 0;
        }
        const inspect = this.inspect(key, { resource: overrides?.resource, overrideIdentifier: overrides?.overrideIdentifiers ? overrides.overrideIdentifiers[0] : void 0 });
        if (inspect.policyValue !== void 0) {
          throw new Error(`Unable to write ${key} because it is configured in system policy.`);
        }
        if ($Pv(value, inspect.defaultValue)) {
          value = void 0;
        }
        if (overrides?.overrideIdentifiers?.length && overrides.overrideIdentifiers.length > 1) {
          const overrideIdentifiers = overrides.overrideIdentifiers.sort();
          const existingOverrides = this.a.localUserConfiguration.overrides.find((override) => $zb([...override.identifiers].sort(), overrideIdentifiers));
          if (existingOverrides) {
            overrides.overrideIdentifiers = existingOverrides.identifiers;
          }
        }
        const path7 = overrides?.overrideIdentifiers?.length ? [$Tt(overrides.overrideIdentifiers), key] : [key];
        await this.j.write(path7, value);
        await this.reloadConfiguration();
      }
      inspect(key, overrides = {}) {
        return this.a.inspect(key, overrides, void 0);
      }
      keys() {
        return this.a.keys(void 0);
      }
      async reloadConfiguration() {
        const configurationModel = await this.f.loadConfiguration();
        this.r(configurationModel);
      }
      r(userConfigurationModel) {
        const previous = this.a.toData();
        const change = this.a.compareAndUpdateLocalUserConfiguration(userConfigurationModel);
        this.u(
          change,
          previous,
          2
          /* ConfigurationTarget.USER */
        );
      }
      s(defaultConfigurationModel, properties) {
        const previous = this.a.toData();
        const change = this.a.compareAndUpdateDefaultConfiguration(defaultConfigurationModel, properties);
        this.u(
          change,
          previous,
          7
          /* ConfigurationTarget.DEFAULT */
        );
      }
      t(policyConfiguration) {
        const previous = this.a.toData();
        const change = this.a.compareAndUpdatePolicyConfiguration(policyConfiguration);
        this.u(
          change,
          previous,
          7
          /* ConfigurationTarget.DEFAULT */
        );
      }
      u(configurationChange, previous, source) {
        const event = new $XB(configurationChange, { data: previous }, this.a, void 0, this.n);
        event.source = source;
        this.h.fire(event);
      }
    };
    ConfigurationEditing = class {
      constructor(b, c, d) {
        this.b = b;
        this.c = c;
        this.d = d;
        this.a = new $3h();
      }
      write(path7, value) {
        return this.a.queue(() => this.e(path7, value));
      }
      async e(path7, value) {
        let content;
        try {
          const fileContent = await this.c.readFile(this.b);
          content = fileContent.value.toString();
        } catch (error) {
          if (error.fileOperationResult === 1) {
            content = "{}";
          } else {
            throw error;
          }
        }
        const parseErrors = [];
        $yw(content, parseErrors, { allowTrailingComma: true, allowEmptyContent: true });
        if (parseErrors.length > 0) {
          throw new Error("Unable to write into the settings file. Please open the file to correct errors/warnings in the file and try again.");
        }
        const edits = this.f(content, path7, value);
        content = $1w(content, edits);
        await this.c.writeFile(this.b, $Ci.fromString(content));
      }
      f(content, path7, value) {
        const { tabSize, insertSpaces, eol } = this.h;
        if (!path7.length) {
          const content2 = JSON.stringify(value, null, insertSpaces ? " ".repeat(tabSize) : "	");
          return [{
            content: content2,
            length: content2.length,
            offset: 0
          }];
        }
        return $Xw(content, path7, value, { tabSize, insertSpaces, eol });
      }
      get h() {
        if (!this.g) {
          let eol = OS === 3 || OS === 2 ? "\n" : "\r\n";
          const configuredEol = this.d.getValue("files.eol", { overrideIdentifier: "jsonc" });
          if (configuredEol && typeof configuredEol === "string" && configuredEol !== "auto") {
            eol = configuredEol;
          }
          this.g = {
            eol,
            insertSpaces: !!this.d.getValue("editor.insertSpaces", { overrideIdentifier: "jsonc" }),
            tabSize: this.d.getValue("editor.tabSize", { overrideIdentifier: "jsonc" })
          };
        }
        return this.g;
      }
    };
  }
});

// out-build/vs/platform/request/common/request.js
function $$u(context) {
  return context.res.statusCode && context.res.statusCode >= 200 && context.res.statusCode < 300 || context.res.statusCode === 1223;
}
function $_u(context) {
  return context.res.statusCode === 204;
}
async function $av(context) {
  if ($_u(context)) {
    return null;
  }
  const buffer = await $Oi(context.stream);
  return buffer.toString();
}
async function $bv(context) {
  if (!$$u(context)) {
    throw new Error("Server returned " + context.res.statusCode);
  }
  return $av(context);
}
async function $cv(context) {
  if (!$$u(context)) {
    throw new Error("Server returned " + context.res.statusCode);
  }
  if ($_u(context)) {
    return null;
  }
  const buffer = await $Oi(context.stream);
  const str = buffer.toString();
  try {
    return JSON.parse(str);
  } catch (err) {
    err.message += ":\n" + str;
    throw err;
  }
}
function registerProxyConfigurations(scope) {
  const configurationRegistry2 = $Wn.as($Ht.Configuration);
  const oldProxyConfiguration = proxyConfiguration;
  proxyConfiguration = {
    id: "http",
    order: 15,
    title: localize(2088, null),
    type: "object",
    scope,
    properties: {
      "http.proxy": {
        type: "string",
        pattern: "^(https?|socks|socks4a?|socks5h?)://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$",
        markdownDescription: localize(2089, null),
        restricted: true
      },
      "http.proxyStrictSSL": {
        type: "boolean",
        default: true,
        description: localize(2090, null),
        restricted: true
      },
      "http.proxyKerberosServicePrincipal": {
        type: "string",
        markdownDescription: localize(2091, null),
        restricted: true
      },
      "http.noProxy": {
        type: "array",
        items: { type: "string" },
        markdownDescription: localize(2092, null),
        restricted: true
      },
      "http.proxyAuthorization": {
        type: ["null", "string"],
        default: null,
        markdownDescription: localize(2093, null),
        restricted: true
      },
      "http.proxySupport": {
        type: "string",
        enum: ["off", "on", "fallback", "override"],
        enumDescriptions: [
          localize(2094, null),
          localize(2095, null),
          localize(2096, null),
          localize(2097, null)
        ],
        default: "override",
        description: localize(2098, null),
        restricted: true
      },
      "http.systemCertificates": {
        type: "boolean",
        default: true,
        description: localize(2099, null),
        restricted: true
      },
      "http.experimental.systemCertificatesV2": {
        type: "boolean",
        tags: ["experimental"],
        default: false,
        description: localize(2100, null),
        restricted: true
      },
      "http.electronFetch": {
        type: "boolean",
        default: false,
        description: localize(2101, null),
        restricted: true
      },
      "http.fetchAdditionalSupport": {
        type: "boolean",
        default: true,
        markdownDescription: localize(2102, null, "`#http.proxySupport#`", "`#http.systemCertificates#`"),
        restricted: true
      }
    }
  };
  configurationRegistry2.updateConfigurations({ add: [proxyConfiguration], remove: oldProxyConfiguration ? [oldProxyConfiguration] : [] });
}
var $9u, LoggableHeaders, $0u, proxyConfiguration;
var init_request = __esm({
  "out-build/vs/platform/request/common/request.js"() {
    "use strict";
    init_buffer();
    init_errors();
    init_lifecycle();
    init_nls2();
    init_configurationRegistry();
    init_instantiation();
    init_platform2();
    $9u = $Qk("requestService");
    LoggableHeaders = class {
      constructor(b) {
        this.b = b;
      }
      toJSON() {
        if (!this.a) {
          const headers = /* @__PURE__ */ Object.create(null);
          for (const key in this.b) {
            if (key.toLowerCase() === "authorization" || key.toLowerCase() === "proxy-authorization") {
              headers[key] = "*****";
            } else {
              headers[key] = this.b[key];
            }
          }
          this.a = headers;
        }
        return this.a;
      }
    };
    $0u = class extends $3c {
      constructor(b) {
        super();
        this.b = b;
        this.a = 0;
      }
      async c(options2, request2) {
        const prefix = `[network] #${++this.a}: ${options2.url}`;
        this.b.trace(`${prefix} - begin`, options2.type, new LoggableHeaders(options2.headers ?? {}));
        try {
          const result = await request2();
          this.b.trace(`${prefix} - end`, options2.type, result.res.statusCode, result.res.headers);
          return result;
        } catch (error) {
          this.b.error(`${prefix} - error`, options2.type, $qb(error));
          throw error;
        }
      }
    };
    registerProxyConfigurations(
      1
      /* ConfigurationScope.APPLICATION */
    );
  }
});

// out-build/vs/platform/environment/common/environment.js
var $Xk, $Yk;
var init_environment = __esm({
  "out-build/vs/platform/environment/common/environment.js"() {
    "use strict";
    init_instantiation();
    $Xk = $Qk("environmentService");
    $Yk = $Rk($Xk);
  }
});

// out-build/vs/base/common/uuid.js
function $os(value) {
  return _UUIDPattern.test(value);
}
var _UUIDPattern, $ps;
var init_uuid = __esm({
  "out-build/vs/base/common/uuid.js"() {
    "use strict";
    _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
    $ps = function() {
      if (typeof crypto === "object" && typeof crypto.randomUUID === "function") {
        return crypto.randomUUID.bind(crypto);
      }
      let getRandomValues;
      if (typeof crypto === "object" && typeof crypto.getRandomValues === "function") {
        getRandomValues = crypto.getRandomValues.bind(crypto);
      } else {
        getRandomValues = function(bucket) {
          for (let i = 0; i < bucket.length; i++) {
            bucket[i] = Math.floor(Math.random() * 256);
          }
          return bucket;
        };
      }
      const _data = new Uint8Array(16);
      const _hex = [];
      for (let i = 0; i < 256; i++) {
        _hex.push(i.toString(16).padStart(2, "0"));
      }
      return function generateUuid() {
        getRandomValues(_data);
        _data[6] = _data[6] & 15 | 64;
        _data[8] = _data[8] & 63 | 128;
        let i = 0;
        let result = "";
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        result += "-";
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        result += "-";
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        result += "-";
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        result += "-";
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        result += _hex[_data[i++]];
        return result;
      };
    }();
  }
});

// out-build/vs/base/common/normalization.js
function $Qs(str) {
  return normalize(str, "NFC", nfcCache);
}
function normalize(str, form, normalizedCache) {
  if (!str) {
    return str;
  }
  const cached = normalizedCache.get(str);
  if (cached) {
    return cached;
  }
  let res;
  if (nonAsciiCharactersPattern.test(str)) {
    res = str.normalize(form);
  } else {
    res = str;
  }
  normalizedCache.set(str, res);
  return res;
}
var nfcCache, nfdCache, nonAsciiCharactersPattern;
var init_normalization = __esm({
  "out-build/vs/base/common/normalization.js"() {
    "use strict";
    init_map();
    nfcCache = new $Hc(1e4);
    nfdCache = new $Hc(1e4);
    nonAsciiCharactersPattern = /[^\u0000-\u0080]/;
  }
});

// out-build/vs/base/node/pfs.js
import * as fs4 from "fs";
import { tmpdir } from "os";
import { promisify } from "util";
async function rimraf(path7, mode = RimRafMode.UNLINK, moveToPath) {
  if ($4g(path7)) {
    throw new Error("rimraf - will refuse to recursively delete root");
  }
  if (mode === RimRafMode.UNLINK) {
    return rimrafUnlink(path7);
  }
  return rimrafMove(path7, moveToPath);
}
async function rimrafMove(path7, moveToPath = $9g(tmpdir())) {
  try {
    try {
      await fs4.promises.rename(path7, moveToPath);
    } catch (error) {
      if (error.code === "ENOENT") {
        return;
      }
      return rimrafUnlink(path7);
    }
    rimrafUnlink(moveToPath).catch((error) => {
    });
  } catch (error) {
    if (error.code !== "ENOENT") {
      throw error;
    }
  }
}
async function rimrafUnlink(path7) {
  return fs4.promises.rm(path7, { recursive: true, force: true, maxRetries: 3 });
}
async function readdir(path7, options2) {
  return handleDirectoryChildren(await (options2 ? safeReaddirWithFileTypes(path7) : fs4.promises.readdir(path7)));
}
async function safeReaddirWithFileTypes(path7) {
  try {
    return await fs4.promises.readdir(path7, { withFileTypes: true });
  } catch (error) {
    console.warn("[node.js fs] readdir with filetypes failed with error: ", error);
  }
  const result = [];
  const children = await readdir(path7);
  for (const child of children) {
    let isFile = false;
    let isDirectory = false;
    let isSymbolicLink = false;
    try {
      const lstat = await fs4.promises.lstat($nc(path7, child));
      isFile = lstat.isFile();
      isDirectory = lstat.isDirectory();
      isSymbolicLink = lstat.isSymbolicLink();
    } catch (error) {
      console.warn("[node.js fs] unexpected error from lstat after readdir: ", error);
    }
    result.push({
      name: child,
      isFile: () => isFile,
      isDirectory: () => isDirectory,
      isSymbolicLink: () => isSymbolicLink
    });
  }
  return result;
}
function handleDirectoryChildren(children) {
  return children.map((child) => {
    if (typeof child === "string") {
      return $m ? $Qs(child) : child;
    }
    child.name = $m ? $Qs(child.name) : child.name;
    return child;
  });
}
async function readDirsInDir(dirPath) {
  const children = await readdir(dirPath);
  const directories = [];
  for (const child of children) {
    if (await SymlinkSupport.existsDirectory($nc(dirPath, child))) {
      directories.push(child);
    }
  }
  return directories;
}
function writeFile2(path7, data, options2) {
  return writeQueues.queueFor(URI.file(path7), () => {
    const ensuredOptions = ensureWriteOptions(options2);
    return new Promise((resolve4, reject) => doWriteFileAndFlush(path7, data, ensuredOptions, (error) => error ? reject(error) : resolve4()));
  }, $mh);
}
function configureFlushOnWrite(enabled) {
  canFlush = enabled;
}
function doWriteFileAndFlush(path7, data, options2, callback) {
  if (!canFlush) {
    return fs4.writeFile(path7, data, { mode: options2.mode, flag: options2.flag }, callback);
  }
  fs4.open(path7, options2.flag, options2.mode, (openError, fd) => {
    if (openError) {
      return callback(openError);
    }
    fs4.writeFile(fd, data, (writeError) => {
      if (writeError) {
        return fs4.close(fd, () => callback(writeError));
      }
      fs4.fdatasync(fd, (syncError) => {
        if (syncError) {
          console.warn("[node.js fs] fdatasync is now disabled for this session because it failed: ", syncError);
          configureFlushOnWrite(false);
        }
        return fs4.close(fd, (closeError) => callback(closeError));
      });
    });
  });
}
function ensureWriteOptions(options2) {
  if (!options2) {
    return { mode: 438, flag: "w" };
  }
  return {
    mode: typeof options2.mode === "number" ? options2.mode : 438,
    flag: typeof options2.flag === "string" ? options2.flag : "w"
  };
}
async function rename(source, target, windowsRetryTimeout = 6e4) {
  if (source === target) {
    return;
  }
  try {
    if ($l && typeof windowsRetryTimeout === "number") {
      await renameWithRetry(source, target, Date.now(), windowsRetryTimeout);
    } else {
      await fs4.promises.rename(source, target);
    }
  } catch (error) {
    if (source.toLowerCase() !== target.toLowerCase() && error.code === "EXDEV" || source.endsWith(".")) {
      await copy(source, target, {
        preserveSymlinks: false
        /* copying to another device */
      });
      await rimraf(source, RimRafMode.MOVE);
    } else {
      throw error;
    }
  }
}
async function renameWithRetry(source, target, startTime, retryTimeout, attempt = 0) {
  try {
    return await fs4.promises.rename(source, target);
  } catch (error) {
    if (error.code !== "EACCES" && error.code !== "EPERM" && error.code !== "EBUSY") {
      throw error;
    }
    if (Date.now() - startTime >= retryTimeout) {
      console.error(`[node.js fs] rename failed after ${attempt} retries with error: ${error}`);
      throw error;
    }
    if (attempt === 0) {
      let abortRetry = false;
      try {
        const { stat } = await SymlinkSupport.stat(target);
        if (!stat.isFile()) {
          abortRetry = true;
        }
      } catch (error2) {
      }
      if (abortRetry) {
        throw error;
      }
    }
    await $Wh(Math.min(100, attempt * 10));
    return renameWithRetry(source, target, startTime, retryTimeout, attempt + 1);
  }
}
async function copy(source, target, options2) {
  return doCopy(source, target, { root: { source, target }, options: options2, handledSourcePaths: /* @__PURE__ */ new Set() });
}
async function doCopy(source, target, payload) {
  if (payload.handledSourcePaths.has(source)) {
    return;
  } else {
    payload.handledSourcePaths.add(source);
  }
  const { stat, symbolicLink } = await SymlinkSupport.stat(source);
  if (symbolicLink) {
    if (payload.options.preserveSymlinks) {
      try {
        return await doCopySymlink(source, target, payload);
      } catch (error) {
      }
    }
    if (symbolicLink.dangling) {
      return;
    }
  }
  if (stat.isDirectory()) {
    return doCopyDirectory(source, target, stat.mode & COPY_MODE_MASK, payload);
  } else {
    return doCopyFile(source, target, stat.mode & COPY_MODE_MASK);
  }
}
async function doCopyDirectory(source, target, mode, payload) {
  await fs4.promises.mkdir(target, { recursive: true, mode });
  const files = await readdir(source);
  for (const file of files) {
    await doCopy($nc(source, file), $nc(target, file), payload);
  }
}
async function doCopyFile(source, target, mode) {
  await fs4.promises.copyFile(source, target);
  await fs4.promises.chmod(target, mode);
}
async function doCopySymlink(source, target, payload) {
  let linkTarget = await fs4.promises.readlink(source);
  if ($Zg(linkTarget, payload.root.source, !$n)) {
    linkTarget = $nc(payload.root.target, linkTarget.substr(payload.root.source.length + 1));
  }
  await fs4.promises.symlink(linkTarget, target);
}
var RimRafMode, SymlinkSupport, writeQueues, canFlush, COPY_MODE_MASK, Promises2;
var init_pfs = __esm({
  "out-build/vs/base/node/pfs.js"() {
    "use strict";
    init_async();
    init_extpath();
    init_normalization();
    init_path();
    init_platform();
    init_resources();
    init_uri();
    (function(RimRafMode2) {
      RimRafMode2[RimRafMode2["UNLINK"] = 0] = "UNLINK";
      RimRafMode2[RimRafMode2["MOVE"] = 1] = "MOVE";
    })(RimRafMode || (RimRafMode = {}));
    (function(SymlinkSupport2) {
      async function stat(path7) {
        let lstats;
        try {
          lstats = await fs4.promises.lstat(path7);
          if (!lstats.isSymbolicLink()) {
            return { stat: lstats };
          }
        } catch (error) {
        }
        try {
          const stats = await fs4.promises.stat(path7);
          return { stat: stats, symbolicLink: lstats?.isSymbolicLink() ? { dangling: false } : void 0 };
        } catch (error) {
          if (error.code === "ENOENT" && lstats) {
            return { stat: lstats, symbolicLink: { dangling: true } };
          }
          if ($l && error.code === "EACCES") {
            try {
              const stats = await fs4.promises.stat(await fs4.promises.readlink(path7));
              return { stat: stats, symbolicLink: { dangling: false } };
            } catch (error2) {
              if (error2.code === "ENOENT" && lstats) {
                return { stat: lstats, symbolicLink: { dangling: true } };
              }
              throw error2;
            }
          }
          throw error;
        }
      }
      SymlinkSupport2.stat = stat;
      async function existsFile(path7) {
        try {
          const { stat: stat2, symbolicLink } = await SymlinkSupport2.stat(path7);
          return stat2.isFile() && symbolicLink?.dangling !== true;
        } catch (error) {
        }
        return false;
      }
      SymlinkSupport2.existsFile = existsFile;
      async function existsDirectory(path7) {
        try {
          const { stat: stat2, symbolicLink } = await SymlinkSupport2.stat(path7);
          return stat2.isDirectory() && symbolicLink?.dangling !== true;
        } catch (error) {
        }
        return false;
      }
      SymlinkSupport2.existsDirectory = existsDirectory;
    })(SymlinkSupport || (SymlinkSupport = {}));
    writeQueues = new $5h();
    canFlush = true;
    COPY_MODE_MASK = 511;
    Promises2 = new class {
      //#region Implemented by node.js
      get read() {
        return (fd, buffer, offset, length, position) => {
          return new Promise((resolve4, reject) => {
            fs4.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
              if (err) {
                return reject(err);
              }
              return resolve4({ bytesRead, buffer: buffer2 });
            });
          });
        };
      }
      get write() {
        return (fd, buffer, offset, length, position) => {
          return new Promise((resolve4, reject) => {
            fs4.write(fd, buffer, offset, length, position, (err, bytesWritten, buffer2) => {
              if (err) {
                return reject(err);
              }
              return resolve4({ bytesWritten, buffer: buffer2 });
            });
          });
        };
      }
      get fdatasync() {
        return promisify(fs4.fdatasync);
      }
      // not exposed as API in 20.x yet
      get open() {
        return promisify(fs4.open);
      }
      // changed to return `FileHandle` in promise API
      get close() {
        return promisify(fs4.close);
      }
      // not exposed as API due to the `FileHandle` return type of `open`
      get realpath() {
        return promisify(fs4.realpath);
      }
      // `fs.promises.realpath` will use `fs.realpath.native` which we do not want
      get ftruncate() {
        return promisify(fs4.ftruncate);
      }
      // not exposed as API in 20.x yet
      //#endregion
      //#region Implemented by us
      async exists(path7) {
        try {
          await fs4.promises.access(path7);
          return true;
        } catch {
          return false;
        }
      }
      get readdir() {
        return readdir;
      }
      get readDirsInDir() {
        return readDirsInDir;
      }
      get writeFile() {
        return writeFile2;
      }
      get rm() {
        return rimraf;
      }
      get rename() {
        return rename;
      }
      get copy() {
        return copy;
      }
    }();
  }
});

// out-build/vs/base/node/powershell.js
import * as os from "os";
function getProgramFilesPath({ useAlternateBitness = false } = {}) {
  if (!useAlternateBitness) {
    return process.env.ProgramFiles || null;
  }
  if (processArch === 0) {
    return process.env["ProgramFiles(x86)"] || null;
  }
  if (osArch === 0) {
    return process.env.ProgramW6432 || null;
  }
  return null;
}
async function findPSCoreWindowsInstallation({ useAlternateBitness = false, findPreview = false } = {}) {
  const programFilesPath = getProgramFilesPath({ useAlternateBitness });
  if (!programFilesPath) {
    return null;
  }
  const powerShellInstallBaseDir = $nc(programFilesPath, "PowerShell");
  if (!await SymlinkSupport.existsDirectory(powerShellInstallBaseDir)) {
    return null;
  }
  let highestSeenVersion = -1;
  let pwshExePath = null;
  for (const item of await Promises2.readdir(powerShellInstallBaseDir)) {
    let currentVersion = -1;
    if (findPreview) {
      const dashIndex = item.indexOf("-");
      if (dashIndex < 0) {
        continue;
      }
      const intPart = item.substring(0, dashIndex);
      if (!IntRegex.test(intPart) || item.substring(dashIndex + 1) !== "preview") {
        continue;
      }
      currentVersion = parseInt(intPart, 10);
    } else {
      if (!IntRegex.test(item)) {
        continue;
      }
      currentVersion = parseInt(item, 10);
    }
    if (currentVersion <= highestSeenVersion) {
      continue;
    }
    const exePath = $nc(powerShellInstallBaseDir, item, "pwsh.exe");
    if (!await SymlinkSupport.existsFile(exePath)) {
      continue;
    }
    pwshExePath = exePath;
    highestSeenVersion = currentVersion;
  }
  if (!pwshExePath) {
    return null;
  }
  const bitness = programFilesPath.includes("x86") ? " (x86)" : "";
  const preview = findPreview ? " Preview" : "";
  return new PossiblePowerShellExe(pwshExePath, `PowerShell${preview}${bitness}`, true);
}
async function findPSCoreMsix({ findPreview } = {}) {
  if (!process.env.LOCALAPPDATA) {
    return null;
  }
  const msixAppDir = $nc(process.env.LOCALAPPDATA, "Microsoft", "WindowsApps");
  if (!await SymlinkSupport.existsDirectory(msixAppDir)) {
    return null;
  }
  const { pwshMsixDirRegex, pwshMsixName } = findPreview ? { pwshMsixDirRegex: PwshPreviewMsixRegex, pwshMsixName: "PowerShell Preview (Store)" } : { pwshMsixDirRegex: PwshMsixRegex, pwshMsixName: "PowerShell (Store)" };
  for (const subdir of await Promises2.readdir(msixAppDir)) {
    if (pwshMsixDirRegex.test(subdir)) {
      const pwshMsixPath = $nc(msixAppDir, subdir, "pwsh.exe");
      return new PossiblePowerShellExe(pwshMsixPath, pwshMsixName);
    }
  }
  return null;
}
function findPSCoreDotnetGlobalTool() {
  const dotnetGlobalToolExePath = $nc(os.homedir(), ".dotnet", "tools", "pwsh.exe");
  return new PossiblePowerShellExe(dotnetGlobalToolExePath, ".NET Core PowerShell Global Tool");
}
function findWinPS() {
  const winPSPath = $nc(process.env.windir, processArch === 1 && osArch !== 1 ? "SysNative" : "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
  return new PossiblePowerShellExe(winPSPath, "Windows PowerShell", true);
}
async function* enumerateDefaultPowerShellInstallations() {
  let pwshExe = await findPSCoreWindowsInstallation();
  if (pwshExe) {
    yield pwshExe;
  }
  pwshExe = await findPSCoreWindowsInstallation({ useAlternateBitness: true });
  if (pwshExe) {
    yield pwshExe;
  }
  pwshExe = await findPSCoreMsix();
  if (pwshExe) {
    yield pwshExe;
  }
  pwshExe = findPSCoreDotnetGlobalTool();
  if (pwshExe) {
    yield pwshExe;
  }
  pwshExe = await findPSCoreWindowsInstallation({ findPreview: true });
  if (pwshExe) {
    yield pwshExe;
  }
  pwshExe = await findPSCoreMsix({ findPreview: true });
  if (pwshExe) {
    yield pwshExe;
  }
  pwshExe = await findPSCoreWindowsInstallation({ useAlternateBitness: true, findPreview: true });
  if (pwshExe) {
    yield pwshExe;
  }
  pwshExe = findWinPS();
  if (pwshExe) {
    yield pwshExe;
  }
}
async function* $Qx() {
  for await (const defaultPwsh of enumerateDefaultPowerShellInstallations()) {
    if (await defaultPwsh.exists()) {
      yield defaultPwsh;
    }
  }
}
async function $Rx() {
  for await (const pwsh of $Qx()) {
    return pwsh;
  }
  return null;
}
var IntRegex, PwshMsixRegex, PwshPreviewMsixRegex, Arch, processArch, osArch, PossiblePowerShellExe;
var init_powershell = __esm({
  "out-build/vs/base/node/powershell.js"() {
    "use strict";
    init_path();
    init_pfs();
    IntRegex = /^\d+$/;
    PwshMsixRegex = /^Microsoft.PowerShell_.*/;
    PwshPreviewMsixRegex = /^Microsoft.PowerShellPreview_.*/;
    (function(Arch2) {
      Arch2[Arch2["x64"] = 0] = "x64";
      Arch2[Arch2["x86"] = 1] = "x86";
      Arch2[Arch2["ARM"] = 2] = "ARM";
    })(Arch || (Arch = {}));
    switch (process.arch) {
      case "ia32":
        processArch = 1;
        break;
      case "arm":
      case "arm64":
        processArch = 2;
        break;
      default:
        processArch = 0;
        break;
    }
    if (process.env["PROCESSOR_ARCHITEW6432"]) {
      osArch = process.env["PROCESSOR_ARCHITEW6432"] === "ARM64" ? 2 : 0;
    } else if (process.env["PROCESSOR_ARCHITECTURE"] === "ARM64") {
      osArch = 2;
    } else if (process.env["PROCESSOR_ARCHITECTURE"] === "X86") {
      osArch = 1;
    } else {
      osArch = 0;
    }
    PossiblePowerShellExe = class {
      constructor(exePath, displayName, a) {
        this.exePath = exePath;
        this.displayName = displayName;
        this.a = a;
      }
      async exists() {
        if (this.a === void 0) {
          this.a = await SymlinkSupport.existsFile(this.exePath);
        }
        return this.a;
      }
    };
  }
});

// out-build/vs/base/common/processes.js
function $Ex(env2, ...preserve) {
  const set = preserve.reduce((set2, key) => {
    set2[key] = true;
    return set2;
  }, {});
  const keysToRemove = [
    /^ELECTRON_.+$/,
    /^VSCODE_(?!(PORTABLE|SHELL_LOGIN|ENV_REPLACE|ENV_APPEND|ENV_PREPEND)).+$/,
    /^SNAP(|_.*)$/,
    /^GDK_PIXBUF_.+$/
  ];
  const envKeys = Object.keys(env2);
  envKeys.filter((key) => !set[key]).forEach((envKey) => {
    for (let i = 0; i < keysToRemove.length; i++) {
      if (envKey.search(keysToRemove[i]) !== -1) {
        delete env2[envKey];
        break;
      }
    }
  });
}
function $Fx(env2) {
  if (!env2) {
    return;
  }
  delete env2["DEBUG"];
  if ($n) {
    delete env2["LD_PRELOAD"];
  }
}
var Source, TerminateResponseCode;
var init_processes = __esm({
  "out-build/vs/base/common/processes.js"() {
    "use strict";
    init_platform();
    (function(Source2) {
      Source2[Source2["stdout"] = 0] = "stdout";
      Source2[Source2["stderr"] = 1] = "stderr";
    })(Source || (Source = {}));
    (function(TerminateResponseCode2) {
      TerminateResponseCode2[TerminateResponseCode2["Success"] = 0] = "Success";
      TerminateResponseCode2[TerminateResponseCode2["Unknown"] = 1] = "Unknown";
      TerminateResponseCode2[TerminateResponseCode2["AccessDenied"] = 2] = "AccessDenied";
      TerminateResponseCode2[TerminateResponseCode2["ProcessNotFound"] = 3] = "ProcessNotFound";
    })(TerminateResponseCode || (TerminateResponseCode = {}));
  }
});

// out-build/vs/base/node/processes.js
import { promises as promises4 } from "fs";
function $Sx(env2 = env) {
  return env2["comspec"] || "cmd.exe";
}
function $Tx(childProcess) {
  let msgQueue = [];
  let useQueue = false;
  const send = function(msg) {
    if (useQueue) {
      msgQueue.push(msg);
      return;
    }
    const result = childProcess.send(msg, (error) => {
      if (error) {
        console.error(error);
      }
      useQueue = false;
      if (msgQueue.length > 0) {
        const msgQueueCopy = msgQueue.slice(0);
        msgQueue = [];
        msgQueueCopy.forEach((entry) => send(entry));
      }
    });
    if (!result || $l) {
      useQueue = true;
    }
  };
  return { send };
}
var win32;
var init_processes2 = __esm({
  "out-build/vs/base/node/processes.js"() {
    "use strict";
    init_path();
    init_platform();
    init_process();
    init_processes();
    init_types();
    init_pfs();
    (function(win322) {
      async function findExecutable(command, cwd3, paths) {
        if ($mc(command)) {
          return command;
        }
        if (cwd3 === void 0) {
          cwd3 = cwd();
        }
        const dir = $qc(command);
        if (dir !== ".") {
          return $nc(cwd3, command);
        }
        if (paths === void 0 && $zg(env["PATH"])) {
          paths = env["PATH"].split($xc);
        }
        if (paths === void 0 || paths.length === 0) {
          return $nc(cwd3, command);
        }
        async function fileExists(path7) {
          if (await Promises2.exists(path7)) {
            let statValue;
            try {
              statValue = await promises4.stat(path7);
            } catch (e) {
              if (e.message.startsWith("EACCES")) {
                statValue = await promises4.lstat(path7);
              }
            }
            return statValue ? !statValue.isDirectory() : false;
          }
          return false;
        }
        for (const pathEntry of paths) {
          let fullPath;
          if ($mc(pathEntry)) {
            fullPath = $nc(pathEntry, command);
          } else {
            fullPath = $nc(cwd3, pathEntry, command);
          }
          if (await fileExists(fullPath)) {
            return fullPath;
          }
          let withExtension = fullPath + ".com";
          if (await fileExists(withExtension)) {
            return withExtension;
          }
          withExtension = fullPath + ".exe";
          if (await fileExists(withExtension)) {
            return withExtension;
          }
        }
        return $nc(cwd3, command);
      }
      win322.findExecutable = findExecutable;
    })(win32 || (win32 = {}));
  }
});

// out-build/vs/base/node/shell.js
import { userInfo } from "os";
async function $Ux(os7, env2) {
  if (os7 === 1) {
    if ($l) {
      return getSystemShellWindows();
    }
    return $Sx(env2);
  }
  return getSystemShellUnixLike(os7, env2);
}
function getSystemShellUnixLike(os7, env2) {
  if ($n && os7 === 2 || $m && os7 === 3) {
    return "/bin/bash";
  }
  if (!_TERMINAL_DEFAULT_SHELL_UNIX_LIKE) {
    let unixLikeTerminal;
    if ($l) {
      unixLikeTerminal = "/bin/bash";
    } else {
      unixLikeTerminal = env2["SHELL"];
      if (!unixLikeTerminal) {
        try {
          unixLikeTerminal = userInfo().shell;
        } catch (err) {
        }
      }
      if (!unixLikeTerminal) {
        unixLikeTerminal = "sh";
      }
      if (unixLikeTerminal === "/bin/false") {
        unixLikeTerminal = "/bin/bash";
      }
    }
    _TERMINAL_DEFAULT_SHELL_UNIX_LIKE = unixLikeTerminal;
  }
  return _TERMINAL_DEFAULT_SHELL_UNIX_LIKE;
}
async function getSystemShellWindows() {
  if (!_TERMINAL_DEFAULT_SHELL_WINDOWS) {
    _TERMINAL_DEFAULT_SHELL_WINDOWS = (await $Rx()).exePath;
  }
  return _TERMINAL_DEFAULT_SHELL_WINDOWS;
}
var _TERMINAL_DEFAULT_SHELL_UNIX_LIKE, _TERMINAL_DEFAULT_SHELL_WINDOWS;
var init_shell = __esm({
  "out-build/vs/base/node/shell.js"() {
    "use strict";
    init_platform();
    init_powershell();
    init_processes2();
    _TERMINAL_DEFAULT_SHELL_UNIX_LIKE = null;
    _TERMINAL_DEFAULT_SHELL_WINDOWS = null;
  }
});

// out-build/vs/platform/environment/node/argv.js
function $jt(args, options2, errorReporter2 = ignoringReporter) {
  const firstArg = args.find((a) => a.length > 0 && a[0] !== "-");
  const alias = {};
  const stringOptions = ["_"];
  const booleanOptions = [];
  const globalOptions = {};
  let command = void 0;
  for (const optionId in options2) {
    const o = options2[optionId];
    if (o.type === "subcommand") {
      if (optionId === firstArg) {
        command = o;
      }
    } else {
      if (o.alias) {
        alias[optionId] = o.alias;
      }
      if (o.type === "string" || o.type === "string[]") {
        stringOptions.push(optionId);
        if (o.deprecates) {
          stringOptions.push(...o.deprecates);
        }
      } else if (o.type === "boolean") {
        booleanOptions.push(optionId);
        if (o.deprecates) {
          booleanOptions.push(...o.deprecates);
        }
      }
      if (o.global) {
        globalOptions[optionId] = o;
      }
    }
  }
  if (command && firstArg) {
    const options3 = globalOptions;
    for (const optionId in command.options) {
      options3[optionId] = command.options[optionId];
    }
    const newArgs = args.filter((a) => a !== firstArg);
    const reporter = errorReporter2.getSubcommandReporter ? errorReporter2.getSubcommandReporter(firstArg) : void 0;
    const subcommandOptions = $jt(newArgs, options3, reporter);
    return {
      [firstArg]: subcommandOptions,
      _: []
    };
  }
  const parsedArgs2 = (0, import_minimist.default)(args, { string: stringOptions, boolean: booleanOptions, alias });
  const cleanedArgs = {};
  const remainingArgs = parsedArgs2;
  cleanedArgs._ = parsedArgs2._.map((arg) => String(arg)).filter((arg) => arg.length > 0);
  delete remainingArgs._;
  for (const optionId in options2) {
    const o = options2[optionId];
    if (o.type === "subcommand") {
      continue;
    }
    if (o.alias) {
      delete remainingArgs[o.alias];
    }
    let val = remainingArgs[optionId];
    if (o.deprecates) {
      for (const deprecatedId of o.deprecates) {
        if (remainingArgs.hasOwnProperty(deprecatedId)) {
          if (!val) {
            val = remainingArgs[deprecatedId];
            if (val) {
              errorReporter2.onDeprecatedOption(deprecatedId, o.deprecationMessage || localize(1783, null, optionId));
            }
          }
          delete remainingArgs[deprecatedId];
        }
      }
    }
    if (typeof val !== "undefined") {
      if (o.type === "string[]") {
        if (!Array.isArray(val)) {
          val = [val];
        }
        if (!o.allowEmptyValue) {
          const sanitized = val.filter((v) => v.length > 0);
          if (sanitized.length !== val.length) {
            errorReporter2.onEmptyValue(optionId);
            val = sanitized.length > 0 ? sanitized : void 0;
          }
        }
      } else if (o.type === "string") {
        if (Array.isArray(val)) {
          val = val.pop();
          errorReporter2.onMultipleValues(optionId, val);
        } else if (!val && !o.allowEmptyValue) {
          errorReporter2.onEmptyValue(optionId);
          val = void 0;
        }
      }
      cleanedArgs[optionId] = val;
      if (o.deprecationMessage) {
        errorReporter2.onDeprecatedOption(optionId, o.deprecationMessage);
      }
    }
    delete remainingArgs[optionId];
  }
  for (const key in remainingArgs) {
    errorReporter2.onUnknownOption(key);
  }
  return cleanedArgs;
}
function formatUsage(optionId, option) {
  let args = "";
  if (option.args) {
    if (Array.isArray(option.args)) {
      args = ` <${option.args.join("> <")}>`;
    } else {
      args = ` <${option.args}>`;
    }
  }
  if (option.alias) {
    return `-${option.alias} --${optionId}${args}`;
  }
  return `--${optionId}${args}`;
}
function $kt(options2, columns) {
  const usageTexts = [];
  for (const optionId in options2) {
    const o = options2[optionId];
    const usageText = formatUsage(optionId, o);
    usageTexts.push([usageText, o.description]);
  }
  return formatUsageTexts(usageTexts, columns);
}
function formatUsageTexts(usageTexts, columns) {
  const maxLength = usageTexts.reduce((previous, e) => Math.max(previous, e[0].length), 12);
  const argLength = maxLength + 2 + 1;
  if (columns - argLength < 25) {
    return usageTexts.reduce((r, ut) => r.concat([`  ${ut[0]}`, `      ${ut[1]}`]), []);
  }
  const descriptionColumns = columns - argLength - 1;
  const result = [];
  for (const ut of usageTexts) {
    const usage = ut[0];
    const wrappedDescription = wrapText(ut[1], descriptionColumns);
    const keyPadding = indent(
      argLength - usage.length - 2
      /*left padding*/
    );
    result.push("  " + usage + keyPadding + wrappedDescription[0]);
    for (let i = 1; i < wrappedDescription.length; i++) {
      result.push(indent(argLength) + wrappedDescription[i]);
    }
  }
  return result;
}
function indent(count) {
  return " ".repeat(count);
}
function wrapText(text, columns) {
  const lines = [];
  while (text.length) {
    const index = text.length < columns ? text.length : text.lastIndexOf(" ", columns);
    const line = text.slice(0, index).trim();
    text = text.slice(index);
    lines.push(line);
  }
  return lines;
}
function $lt(productName, executableName, version, options2, capabilities) {
  const columns = process.stdout.isTTY && process.stdout.columns || 80;
  const inputFiles = capabilities?.noInputFiles !== true ? `[${localize(1784, null)}...]` : "";
  const help = [`${productName} ${version}`];
  help.push("");
  help.push(`${localize(1785, null)}: ${executableName} [${localize(1786, null)}]${inputFiles}`);
  help.push("");
  if (capabilities?.noPipe !== true) {
    if ($l) {
      help.push(localize(1787, null, executableName));
    } else {
      help.push(localize(1788, null, executableName));
    }
    help.push("");
  }
  const optionsByCategory = {};
  const subcommands = [];
  for (const optionId in options2) {
    const o = options2[optionId];
    if (o.type === "subcommand") {
      if (o.description) {
        subcommands.push({ command: optionId, description: o.description });
      }
    } else if (o.description && o.cat) {
      let optionsByCat = optionsByCategory[o.cat];
      if (!optionsByCat) {
        optionsByCategory[o.cat] = optionsByCat = {};
      }
      optionsByCat[optionId] = o;
    }
  }
  for (const helpCategoryKey in optionsByCategory) {
    const key = helpCategoryKey;
    const categoryOptions = optionsByCategory[key];
    if (categoryOptions) {
      help.push(helpCategories[key]);
      help.push(...$kt(categoryOptions, columns));
      help.push("");
    }
  }
  if (subcommands.length) {
    help.push(localize(1789, null));
    help.push(...formatUsageTexts(subcommands.map((s) => [s.command, s.description]), columns));
    help.push("");
  }
  return help.join("\n");
}
function $mt(version, commit) {
  return `${version || localize(1790, null)}
${commit || localize(1791, null)}
${process.arch}`;
}
var import_minimist, helpCategories, $it, ignoringReporter;
var init_argv = __esm({
  "out-build/vs/platform/environment/node/argv.js"() {
    "use strict";
    import_minimist = __toESM(require_minimist(), 1);
    init_platform();
    init_nls2();
    helpCategories = {
      o: localize(1744, null),
      e: localize(1745, null),
      t: localize(1746, null)
    };
    $it = {
      "tunnel": {
        type: "subcommand",
        description: "Make the current machine accessible from vscode.dev or other machines through a secure tunnel",
        options: {
          "cli-data-dir": { type: "string", args: "dir", description: localize(1747, null) },
          "disable-telemetry": { type: "boolean" },
          "telemetry-level": { type: "string" },
          user: {
            type: "subcommand",
            options: {
              login: {
                type: "subcommand",
                options: {
                  provider: { type: "string" },
                  "access-token": { type: "string" }
                }
              }
            }
          }
        }
      },
      "serve-web": {
        type: "subcommand",
        description: "Run a server that displays the editor UI in browsers.",
        options: {
          "cli-data-dir": { type: "string", args: "dir", description: localize(1748, null) },
          "disable-telemetry": { type: "boolean" },
          "telemetry-level": { type: "string" }
        }
      },
      "diff": { type: "boolean", cat: "o", alias: "d", args: ["file", "file"], description: localize(1749, null) },
      "merge": { type: "boolean", cat: "o", alias: "m", args: ["path1", "path2", "base", "result"], description: localize(1750, null) },
      "add": { type: "boolean", cat: "o", alias: "a", args: "folder", description: localize(1751, null) },
      "goto": { type: "boolean", cat: "o", alias: "g", args: "file:line[:character]", description: localize(1752, null) },
      "new-window": { type: "boolean", cat: "o", alias: "n", description: localize(1753, null) },
      "reuse-window": { type: "boolean", cat: "o", alias: "r", description: localize(1754, null) },
      "wait": { type: "boolean", cat: "o", alias: "w", description: localize(1755, null) },
      "waitMarkerFilePath": { type: "string" },
      "locale": { type: "string", cat: "o", args: "locale", description: localize(1756, null) },
      "user-data-dir": { type: "string", cat: "o", args: "dir", description: localize(1757, null) },
      "profile": { type: "string", "cat": "o", args: "profileName", description: localize(1758, null) },
      "help": { type: "boolean", cat: "o", alias: "h", description: localize(1759, null) },
      "extensions-dir": { type: "string", deprecates: ["extensionHomePath"], cat: "e", args: "dir", description: localize(1760, null) },
      "extensions-download-dir": { type: "string" },
      "builtin-extensions-dir": { type: "string" },
      "list-extensions": { type: "boolean", cat: "e", description: localize(1761, null) },
      "show-versions": { type: "boolean", cat: "e", description: localize(1762, null) },
      "category": { type: "string", allowEmptyValue: true, cat: "e", description: localize(1763, null), args: "category" },
      "install-extension": { type: "string[]", cat: "e", args: "ext-id | path", description: localize(1764, null) },
      "pre-release": { type: "boolean", cat: "e", description: localize(1765, null) },
      "uninstall-extension": { type: "string[]", cat: "e", args: "ext-id", description: localize(1766, null) },
      "update-extensions": { type: "boolean", cat: "e", description: localize(1767, null) },
      "enable-proposed-api": { type: "string[]", allowEmptyValue: true, cat: "e", args: "ext-id", description: localize(1768, null) },
      "version": { type: "boolean", cat: "t", alias: "v", description: localize(1769, null) },
      "verbose": { type: "boolean", cat: "t", global: true, description: localize(1770, null) },
      "log": { type: "string[]", cat: "t", args: "level", global: true, description: localize(1771, null) },
      "status": { type: "boolean", alias: "s", cat: "t", description: localize(1772, null) },
      "prof-startup": { type: "boolean", cat: "t", description: localize(1773, null) },
      "prof-append-timers": { type: "string" },
      "prof-duration-markers": { type: "string[]" },
      "prof-duration-markers-file": { type: "string" },
      "no-cached-data": { type: "boolean" },
      "prof-startup-prefix": { type: "string" },
      "prof-v8-extensions": { type: "boolean" },
      "disable-extensions": { type: "boolean", deprecates: ["disableExtensions"], cat: "t", description: localize(1774, null) },
      "disable-extension": { type: "string[]", cat: "t", args: "ext-id", description: localize(1775, null) },
      "sync": { type: "string", cat: "t", description: localize(1776, null), args: ["on | off"] },
      "inspect-extensions": { type: "string", allowEmptyValue: true, deprecates: ["debugPluginHost"], args: "port", cat: "t", description: localize(1777, null) },
      "inspect-brk-extensions": { type: "string", allowEmptyValue: true, deprecates: ["debugBrkPluginHost"], args: "port", cat: "t", description: localize(1778, null) },
      "disable-lcd-text": { type: "boolean", cat: "t", description: localize(1779, null) },
      "disable-gpu": { type: "boolean", cat: "t", description: localize(1780, null) },
      "disable-chromium-sandbox": { type: "boolean", cat: "t", description: localize(1781, null) },
      "sandbox": { type: "boolean" },
      "telemetry": { type: "boolean", cat: "t", description: localize(1782, null) },
      "remote": { type: "string", allowEmptyValue: true },
      "folder-uri": { type: "string[]", cat: "o", args: "uri" },
      "file-uri": { type: "string[]", cat: "o", args: "uri" },
      "locate-extension": { type: "string[]" },
      "extensionDevelopmentPath": { type: "string[]" },
      "extensionDevelopmentKind": { type: "string[]" },
      "extensionTestsPath": { type: "string" },
      "extensionEnvironment": { type: "string" },
      "debugId": { type: "string" },
      "debugRenderer": { type: "boolean" },
      "inspect-ptyhost": { type: "string", allowEmptyValue: true },
      "inspect-brk-ptyhost": { type: "string", allowEmptyValue: true },
      "inspect-search": { type: "string", deprecates: ["debugSearch"], allowEmptyValue: true },
      "inspect-brk-search": { type: "string", deprecates: ["debugBrkSearch"], allowEmptyValue: true },
      "inspect-sharedprocess": { type: "string", allowEmptyValue: true },
      "inspect-brk-sharedprocess": { type: "string", allowEmptyValue: true },
      "export-default-configuration": { type: "string" },
      "install-source": { type: "string" },
      "enable-smoke-test-driver": { type: "boolean" },
      "logExtensionHostCommunication": { type: "boolean" },
      "skip-release-notes": { type: "boolean" },
      "skip-welcome": { type: "boolean" },
      "disable-telemetry": { type: "boolean" },
      "disable-updates": { type: "boolean" },
      "use-inmemory-secretstorage": { type: "boolean", deprecates: ["disable-keytar"] },
      "password-store": { type: "string" },
      "disable-workspace-trust": { type: "boolean" },
      "disable-crash-reporter": { type: "boolean" },
      "crash-reporter-directory": { type: "string" },
      "crash-reporter-id": { type: "string" },
      "skip-add-to-recently-opened": { type: "boolean" },
      "open-url": { type: "boolean" },
      "file-write": { type: "boolean" },
      "file-chmod": { type: "boolean" },
      "install-builtin-extension": { type: "string[]" },
      "force": { type: "boolean" },
      "do-not-sync": { type: "boolean" },
      "trace": { type: "boolean" },
      "trace-category-filter": { type: "string" },
      "trace-options": { type: "string" },
      "preserve-env": { type: "boolean" },
      "force-user-env": { type: "boolean" },
      "force-disable-user-env": { type: "boolean" },
      "open-devtools": { type: "boolean" },
      "disable-gpu-sandbox": { type: "boolean" },
      "logsPath": { type: "string" },
      "__enable-file-policy": { type: "boolean" },
      "editSessionId": { type: "string" },
      "continueOn": { type: "string" },
      "locate-shell-integration-path": { type: "string", args: ["bash", "pwsh", "zsh", "fish"] },
      "enable-coi": { type: "boolean" },
      // chromium flags
      "no-proxy-server": { type: "boolean" },
      // Minimist incorrectly parses keys that start with `--no`
      // https://github.com/substack/minimist/blob/aeb3e27dae0412de5c0494e9563a5f10c82cc7a9/index.js#L118-L121
      // If --no-sandbox is passed via cli wrapper it will be treated as --sandbox which is incorrect, we use
      // the alias here to make sure --no-sandbox is always respected.
      // For https://github.com/microsoft/vscode/issues/128279
      "no-sandbox": { type: "boolean", alias: "sandbox" },
      "proxy-server": { type: "string" },
      "proxy-bypass-list": { type: "string" },
      "proxy-pac-url": { type: "string" },
      "js-flags": { type: "string" },
      // chrome js flags
      "inspect": { type: "string", allowEmptyValue: true },
      "inspect-brk": { type: "string", allowEmptyValue: true },
      "nolazy": { type: "boolean" },
      // node inspect
      "force-device-scale-factor": { type: "string" },
      "force-renderer-accessibility": { type: "boolean" },
      "ignore-certificate-errors": { type: "boolean" },
      "allow-insecure-localhost": { type: "boolean" },
      "log-net-log": { type: "string" },
      "vmodule": { type: "string" },
      "_urls": { type: "string[]" },
      "disable-dev-shm-usage": { type: "boolean" },
      "profile-temp": { type: "boolean" },
      "ozone-platform": { type: "string" },
      "enable-tracing": { type: "string" },
      "trace-startup-format": { type: "string" },
      "trace-startup-file": { type: "string" },
      "trace-startup-duration": { type: "string" },
      _: { type: "string[]" }
      // main arguments
    };
    ignoringReporter = {
      onUnknownOption: () => {
      },
      onMultipleValues: () => {
      },
      onEmptyValue: () => {
      },
      onDeprecatedOption: () => {
      }
    };
  }
});

// out-build/vs/platform/environment/node/argvHelper.js
import assert from "assert";
function $qt(env2) {
  return env2["VSCODE_CLI"] === "1";
}
var init_argvHelper = __esm({
  "out-build/vs/platform/environment/node/argvHelper.js"() {
    "use strict";
    init_nls2();
    init_argv();
  }
});

// out-build/vs/base/common/numbers.js
function $4i(value, min, max) {
  return Math.min(Math.max(value, min), max);
}
var init_numbers = __esm({
  "out-build/vs/base/common/numbers.js"() {
    "use strict";
  }
});

// out-build/vs/platform/shell/node/shellEnv.js
import { spawn } from "child_process";
async function $Vx(configurationService, logService, args, env2) {
  if (args["force-disable-user-env"]) {
    logService.trace("resolveShellEnv(): skipped (--force-disable-user-env)");
    return {};
  } else if ($l) {
    logService.trace("resolveShellEnv(): skipped (Windows)");
    return {};
  } else if ($qt(env2) && !args["force-user-env"]) {
    logService.trace("resolveShellEnv(): skipped (VSCODE_CLI is set)");
    return {};
  } else {
    if ($qt(env2)) {
      logService.trace("resolveShellEnv(): running (--force-user-env)");
    } else {
      logService.trace("resolveShellEnv(): running (macOS/Linux)");
    }
    if (!unixShellEnvPromise) {
      unixShellEnvPromise = Promises.withAsyncBody(async (resolve4, reject) => {
        const cts = new $ad();
        let timeoutValue = 1e4;
        const configuredTimeoutValue = configurationService.getValue("application.shellEnvironmentResolutionTimeout");
        if (typeof configuredTimeoutValue === "number") {
          timeoutValue = $4i(configuredTimeoutValue, 1, 120) * 1e3;
        }
        const timeout = setTimeout(() => {
          cts.dispose(true);
          reject(new Error(localize(2103, null)));
        }, timeoutValue);
        try {
          resolve4(await doResolveUnixShellEnv(logService, cts.token));
        } catch (error) {
          if (!$kb(error) && !cts.token.isCancellationRequested) {
            reject(new Error(localize(2104, null, $1m(error))));
          } else {
            resolve4({});
          }
        } finally {
          clearTimeout(timeout);
          cts.dispose();
        }
      });
    }
    return unixShellEnvPromise;
  }
}
async function doResolveUnixShellEnv(logService, token) {
  const runAsNode = process.env["ELECTRON_RUN_AS_NODE"];
  logService.trace("getUnixShellEnvironment#runAsNode", runAsNode);
  const noAttach = process.env["ELECTRON_NO_ATTACH_CONSOLE"];
  logService.trace("getUnixShellEnvironment#noAttach", noAttach);
  const mark = $ps().replace(/-/g, "").substr(0, 12);
  const regex = new RegExp(mark + "({.*})" + mark);
  const env2 = {
    ...process.env,
    ELECTRON_RUN_AS_NODE: "1",
    ELECTRON_NO_ATTACH_CONSOLE: "1",
    VSCODE_RESOLVING_ENVIRONMENT: "1"
  };
  logService.trace("getUnixShellEnvironment#env", env2);
  const systemShellUnix = await $Ux(OS, env2);
  logService.trace("getUnixShellEnvironment#shell", systemShellUnix);
  return new Promise((resolve4, reject) => {
    if (token.isCancellationRequested) {
      return reject(new $lb());
    }
    const name = $rc(systemShellUnix);
    let command, shellArgs;
    const extraArgs = "";
    if (/^pwsh(-preview)?$/.test(name)) {
      command = `& '${process.execPath}' ${extraArgs} -p '''${mark}'' + JSON.stringify(process.env) + ''${mark}'''`;
      shellArgs = ["-Login", "-Command"];
    } else if (name === "nu") {
      command = `^'${process.execPath}' ${extraArgs} -p '"${mark}" + JSON.stringify(process.env) + "${mark}"'`;
      shellArgs = ["-i", "-l", "-c"];
    } else if (name === "xonsh") {
      command = `import os, json; print("${mark}", json.dumps(dict(os.environ)), "${mark}")`;
      shellArgs = ["-i", "-l", "-c"];
    } else {
      command = `'${process.execPath}' ${extraArgs} -p '"${mark}" + JSON.stringify(process.env) + "${mark}"'`;
      if (name === "tcsh" || name === "csh") {
        shellArgs = ["-ic"];
      } else {
        shellArgs = ["-i", "-l", "-c"];
      }
    }
    logService.trace("getUnixShellEnvironment#spawn", JSON.stringify(shellArgs), command);
    const child = spawn(systemShellUnix, [...shellArgs, command], {
      detached: true,
      stdio: ["ignore", "pipe", "pipe"],
      env: env2
    });
    token.onCancellationRequested(() => {
      child.kill();
      return reject(new $lb());
    });
    child.on("error", (err) => {
      logService.error("getUnixShellEnvironment#errorChildProcess", $1m(err));
      reject(err);
    });
    const buffers = [];
    child.stdout.on("data", (b) => buffers.push(b));
    const stderr = [];
    child.stderr.on("data", (b) => stderr.push(b));
    child.on("close", (code, signal) => {
      const raw = Buffer.concat(buffers).toString("utf8");
      logService.trace("getUnixShellEnvironment#raw", raw);
      const stderrStr = Buffer.concat(stderr).toString("utf8");
      if (stderrStr.trim()) {
        logService.trace("getUnixShellEnvironment#stderr", stderrStr);
      }
      if (code || signal) {
        return reject(new Error(localize(2105, null, code, signal)));
      }
      const match = regex.exec(raw);
      const rawStripped = match ? match[1] : "{}";
      try {
        const env3 = JSON.parse(rawStripped);
        if (runAsNode) {
          env3["ELECTRON_RUN_AS_NODE"] = runAsNode;
        } else {
          delete env3["ELECTRON_RUN_AS_NODE"];
        }
        if (noAttach) {
          env3["ELECTRON_NO_ATTACH_CONSOLE"] = noAttach;
        } else {
          delete env3["ELECTRON_NO_ATTACH_CONSOLE"];
        }
        delete env3["VSCODE_RESOLVING_ENVIRONMENT"];
        delete env3["XDG_RUNTIME_DIR"];
        logService.trace("getUnixShellEnvironment#result", env3);
        resolve4(env3);
      } catch (err) {
        logService.error("getUnixShellEnvironment#errorCaught", $1m(err));
        reject(err);
      }
    });
  });
}
var unixShellEnvPromise;
var init_shellEnv = __esm({
  "out-build/vs/platform/shell/node/shellEnv.js"() {
    "use strict";
    init_path();
    init_nls2();
    init_cancellation();
    init_errorMessage();
    init_errors();
    init_platform();
    init_uuid();
    init_shell();
    init_argvHelper();
    init_async();
    init_numbers();
    unixShellEnvPromise = void 0;
  }
});

// out-build/vs/platform/request/node/proxy.js
import { parse as parseUrl } from "url";
function getSystemProxyURI(requestURL, env2) {
  if (requestURL.protocol === "http:") {
    return env2.HTTP_PROXY || env2.http_proxy || null;
  } else if (requestURL.protocol === "https:") {
    return env2.HTTPS_PROXY || env2.https_proxy || env2.HTTP_PROXY || env2.http_proxy || null;
  }
  return null;
}
async function $JC(rawRequestURL, env2, options2 = {}) {
  const requestURL = parseUrl(rawRequestURL);
  const proxyURL = options2.proxyUrl || getSystemProxyURI(requestURL, env2);
  if (!proxyURL) {
    return null;
  }
  const proxyEndpoint = parseUrl(proxyURL);
  if (!/^https?:$/.test(proxyEndpoint.protocol || "")) {
    return null;
  }
  const opts = {
    host: proxyEndpoint.hostname || "",
    port: (proxyEndpoint.port ? +proxyEndpoint.port : 0) || (proxyEndpoint.protocol === "https" ? 443 : 80),
    auth: proxyEndpoint.auth,
    rejectUnauthorized: $Fg(options2.strictSSL) ? options2.strictSSL : true
  };
  if (requestURL.protocol === "http:") {
    const { default: mod } = await import("http-proxy-agent");
    return new mod.HttpProxyAgent(proxyURL, opts);
  } else {
    const { default: mod } = await import("https-proxy-agent");
    return new mod.HttpsProxyAgent(proxyURL, opts);
  }
}
var init_proxy = __esm({
  "out-build/vs/platform/request/node/proxy.js"() {
    "use strict";
    init_types();
  }
});

// out-build/vs/platform/request/node/requestService.js
import { parse as parseUrl2 } from "url";
import { createGunzip } from "zlib";
async function $LC(urlStr, spnConfig, logService, logPrefix) {
  const importKerberos = await import("kerberos");
  const kerberos = importKerberos.default || importKerberos;
  const url3 = new URL(urlStr);
  const spn = spnConfig || (process.platform === "win32" ? `HTTP/${url3.hostname}` : `HTTP@${url3.hostname}`);
  logService.debug(`${logPrefix} Kerberos authentication lookup`, `proxyURL:${url3}`, `spn:${spn}`);
  const client = await kerberos.initializeClient(spn);
  return client.step("");
}
async function getNodeRequest(options2) {
  const endpoint = parseUrl2(options2.url);
  const module2 = endpoint.protocol === "https:" ? await import("https") : await import("http");
  return module2.request;
}
async function $MC(options2, token) {
  return Promises.withAsyncBody(async (resolve4, reject) => {
    const endpoint = parseUrl2(options2.url);
    const rawRequest = options2.getRawRequest ? options2.getRawRequest(options2) : await getNodeRequest(options2);
    const opts = {
      hostname: endpoint.hostname,
      port: endpoint.port ? parseInt(endpoint.port) : endpoint.protocol === "https:" ? 443 : 80,
      protocol: endpoint.protocol,
      path: endpoint.path,
      method: options2.type || "GET",
      headers: options2.headers,
      agent: options2.agent,
      rejectUnauthorized: $Fg(options2.strictSSL) ? options2.strictSSL : true
    };
    if (options2.user && options2.password) {
      opts.auth = options2.user + ":" + options2.password;
    }
    const req = rawRequest(opts, (res) => {
      const followRedirects = $Dg(options2.followRedirects) ? options2.followRedirects : 3;
      if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers["location"]) {
        $MC({
          ...options2,
          url: res.headers["location"],
          followRedirects: followRedirects - 1
        }, token).then(resolve4, reject);
      } else {
        let stream = res;
        if (!options2.isChromiumNetwork && res.headers["content-encoding"] === "gzip") {
          stream = res.pipe(createGunzip());
        }
        resolve4({ res, stream: $Ri(stream) });
      }
    });
    req.on("error", reject);
    if (options2.timeout) {
      req.setTimeout(options2.timeout);
    }
    if (options2.isChromiumNetwork) {
      req.removeHeader("Content-Length");
    }
    if (options2.data) {
      if (typeof options2.data === "string") {
        req.write(options2.data);
      }
    }
    req.end();
    token.onCancellationRequested(() => {
      req.abort();
      reject(new $lb());
    });
  });
}
var $KC;
var init_requestService = __esm({
  "out-build/vs/platform/request/node/requestService.js"() {
    "use strict";
    init_async();
    init_buffer();
    init_errors();
    init_types();
    init_configuration();
    init_environment();
    init_shellEnv();
    init_log();
    init_request();
    init_proxy();
    $KC = class $KC2 extends $0u {
      constructor(m, n, logService) {
        super(logService);
        this.m = m;
        this.n = n;
        this.r();
        this.B(m.onDidChangeConfiguration((e) => {
          if (e.affectsConfiguration("http")) {
            this.r();
          }
        }));
      }
      r() {
        const config = this.m.getValue("http");
        this.f = config?.proxy;
        this.g = !!config?.proxyStrictSSL;
        this.h = config?.proxyAuthorization;
      }
      async request(options2, token) {
        const { f: proxyUrl, g: strictSSL } = this;
        let shellEnv = void 0;
        try {
          shellEnv = await $Vx(this.m, this.b, this.n.args, process.env);
        } catch (error) {
          if (!this.j) {
            this.j = true;
            this.b.error(`resolving shell environment failed`, $qb(error));
          }
        }
        const env2 = {
          ...process.env,
          ...shellEnv
        };
        const agent = options2.agent ? options2.agent : await $JC(options2.url || "", env2, { proxyUrl, strictSSL });
        options2.agent = agent;
        options2.strictSSL = strictSSL;
        if (this.h) {
          options2.headers = {
            ...options2.headers || {},
            "Proxy-Authorization": this.h
          };
        }
        return this.c(options2, () => $MC(options2, token));
      }
      async resolveProxy(url3) {
        return void 0;
      }
      async lookupAuthorization(authInfo) {
        return void 0;
      }
      async lookupKerberosAuthorization(urlStr) {
        try {
          const spnConfig = this.m.getValue("http.proxyKerberosServicePrincipal");
          const response = await $LC(urlStr, spnConfig, this.b, "RequestService#lookupKerberosAuthorization");
          return "Negotiate " + response;
        } catch (err) {
          this.b.debug("RequestService#lookupKerberosAuthorization Kerberos authentication failed", err);
          return void 0;
        }
      }
      async loadCertificates() {
        const proxyAgent = await import("@vscode/proxy-agent");
        return proxyAgent.loadSystemCertificates({ log: this.b });
      }
    };
    $KC = __decorate([
      __param(0, $kl),
      __param(1, $Yk),
      __param(2, $wn)
    ], $KC);
  }
});

// out-build/vs/platform/remote/common/remoteHosts.js
function $9v(authority) {
  if (!authority) {
    return void 0;
  }
  const pos = authority.indexOf("+");
  if (pos < 0) {
    return authority;
  }
  return authority.substr(0, pos);
}
var init_remoteHosts = __esm({
  "out-build/vs/platform/remote/common/remoteHosts.js"() {
    "use strict";
    init_network();
  }
});

// out-build/vs/platform/telemetry/common/commonProperties.js
function getPlatformDetail(hostname2) {
  if ($x === 2 && /^penguin(\.|$)/i.test(hostname2)) {
    return "chromebook";
  }
  return void 0;
}
function $_v(release4, hostname2, arch2, commit, version, machineId2, sqmId, devDeviceId, isInternalTelemetry, product2) {
  const result = /* @__PURE__ */ Object.create(null);
  result["common.machineId"] = machineId2;
  result["common.sqmId"] = sqmId;
  result["common.devDeviceId"] = devDeviceId;
  result["sessionID"] = $ps() + Date.now();
  result["commitHash"] = commit;
  result["version"] = version;
  result["common.platformVersion"] = (release4 || "").replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/, "$1$2$3");
  result["common.platform"] = $k($x);
  result["common.nodePlatform"] = $hc;
  result["common.nodeArch"] = arch2;
  result["common.product"] = product2 || "desktop";
  if (isInternalTelemetry) {
    result["common.msftInternal"] = isInternalTelemetry;
  }
  let seq = 0;
  const startTime = Date.now();
  Object.defineProperties(result, {
    // __GDPR__COMMON__ "timestamp" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
    "timestamp": {
      get: () => /* @__PURE__ */ new Date(),
      enumerable: true
    },
    // __GDPR__COMMON__ "common.timesincesessionstart" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
    "common.timesincesessionstart": {
      get: () => Date.now() - startTime,
      enumerable: true
    },
    // __GDPR__COMMON__ "common.sequence" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
    "common.sequence": {
      get: () => seq++,
      enumerable: true
    }
  });
  if ($o) {
    result["common.snap"] = "true";
  }
  const platformDetail = getPlatformDetail(hostname2);
  if (platformDetail) {
    result["common.platformDetail"] = platformDetail;
  }
  return result;
}
function $aw(domainList) {
  const userDnsDomain = env["USERDNSDOMAIN"];
  if (!userDnsDomain) {
    return false;
  }
  const domain = userDnsDomain.toLowerCase();
  return domainList.some((msftDomain) => domain === msftDomain);
}
var init_commonProperties = __esm({
  "out-build/vs/platform/telemetry/common/commonProperties.js"() {
    "use strict";
    init_platform();
    init_process();
    init_uuid();
  }
});

// out-build/vs/platform/telemetry/common/telemetry.js
var $zv, $Av, $Hv, $Iv, $Jv, $Kv, TelemetryLevel, TelemetryConfiguration;
var init_telemetry = __esm({
  "out-build/vs/platform/telemetry/common/telemetry.js"() {
    "use strict";
    init_instantiation();
    $zv = $Qk("telemetryService");
    $Av = $Qk("customEndpointTelemetryService");
    $Hv = "telemetry";
    $Iv = "telemetry.telemetryLevel";
    $Jv = "telemetry.enableCrashReporter";
    $Kv = "telemetry.enableTelemetry";
    (function(TelemetryLevel2) {
      TelemetryLevel2[TelemetryLevel2["NONE"] = 0] = "NONE";
      TelemetryLevel2[TelemetryLevel2["CRASH"] = 1] = "CRASH";
      TelemetryLevel2[TelemetryLevel2["ERROR"] = 2] = "ERROR";
      TelemetryLevel2[TelemetryLevel2["USAGE"] = 3] = "USAGE";
    })(TelemetryLevel || (TelemetryLevel = {}));
    (function(TelemetryConfiguration2) {
      TelemetryConfiguration2["OFF"] = "off";
      TelemetryConfiguration2["CRASH"] = "crash";
      TelemetryConfiguration2["ERROR"] = "error";
      TelemetryConfiguration2["ON"] = "all";
    })(TelemetryConfiguration || (TelemetryConfiguration = {}));
  }
});

// out-build/vs/platform/telemetry/common/telemetryUtils.js
function $iw(productService, environmentService) {
  if (!environmentService.isBuilt && !environmentService.disableTelemetry) {
    return true;
  }
  return !(environmentService.disableTelemetry || !productService.enableTelemetry);
}
function $jw(productService, environmentService) {
  if (environmentService.extensionTestsLocationURI) {
    return true;
  }
  if (environmentService.isBuilt) {
    return false;
  }
  if (environmentService.disableTelemetry) {
    return false;
  }
  if (productService.enableTelemetry && productService.aiConfig?.ariaKey) {
    return false;
  }
  return true;
}
function $kw(configurationService) {
  const newConfig = configurationService.getValue($Iv);
  const crashReporterConfig = configurationService.getValue($Jv);
  const oldConfig = configurationService.getValue($Kv);
  if (oldConfig === false || crashReporterConfig === false) {
    return 0;
  }
  switch (newConfig ?? "all") {
    case "all":
      return 3;
    case "error":
      return 2;
    case "crash":
      return 1;
    case "off":
      return 0;
  }
}
function $lw(data) {
  const properties = {};
  const measurements = {};
  const flat = {};
  flatten(data, flat);
  for (let prop in flat) {
    prop = prop.length > 150 ? prop.substr(prop.length - 149) : prop;
    const value = flat[prop];
    if (typeof value === "number") {
      measurements[prop] = value;
    } else if (typeof value === "boolean") {
      measurements[prop] = value ? 1 : 0;
    } else if (typeof value === "string") {
      if (value.length > 8192) {
        console.warn(`Telemetry property: ${prop} has been trimmed to 8192, the original length is ${value.length}`);
      }
      properties[prop] = value.substring(0, 8191);
    } else if (typeof value !== "undefined" && value !== null) {
      properties[prop] = value;
    }
  }
  return {
    properties,
    measurements
  };
}
function $mw(remoteAuthority) {
  if (!remoteAuthority) {
    return "none";
  }
  const remoteName = $9v(remoteAuthority);
  return telemetryAllowedAuthorities.has(remoteName) ? remoteName : "other";
}
function flatten(obj, result, order = 0, prefix) {
  if (!obj) {
    return;
  }
  for (const item of Object.getOwnPropertyNames(obj)) {
    const value = obj[item];
    const index = prefix ? prefix + item : item;
    if (Array.isArray(value)) {
      result[index] = $Qv(value);
    } else if (value instanceof Date) {
      result[index] = value.toISOString();
    } else if ($Bg(value)) {
      if (order < 2) {
        flatten(value, result, order + 1, index + ".");
      } else {
        result[index] = $Qv(value);
      }
    } else {
      result[index] = value;
    }
  }
}
function $nw(productService, configService) {
  const msftInternalDomains = productService.msftInternalDomains || [];
  const internalTesting = configService.getValue("telemetry.internalTesting");
  return $aw(msftInternalDomains) || internalTesting;
}
function $ow(paths) {
  return [paths.appRoot, paths.extensionsPath, paths.userHome.fsPath, paths.tmpDir.fsPath, paths.userDataPath];
}
function anonymizeFilePaths(stack, cleanupPatterns) {
  if (!stack || !stack.includes("/") && !stack.includes("\\")) {
    return stack;
  }
  let updatedStack = stack;
  const cleanUpIndexes = [];
  for (const regexp of cleanupPatterns) {
    while (true) {
      const result = regexp.exec(stack);
      if (!result) {
        break;
      }
      cleanUpIndexes.push([result.index, regexp.lastIndex]);
    }
  }
  const nodeModulesRegex = /^[\\\/]?(node_modules|node_modules\.asar)[\\\/]/;
  const fileRegex = /(file:\/\/)?([a-zA-Z]:(\\\\|\\|\/)|(\\\\|\\|\/))?([\w-\._]+(\\\\|\\|\/))+[\w-\._]*/g;
  let lastIndex = 0;
  updatedStack = "";
  while (true) {
    const result = fileRegex.exec(stack);
    if (!result) {
      break;
    }
    const overlappingRange = cleanUpIndexes.some(([start, end]) => result.index < end && start < fileRegex.lastIndex);
    if (!nodeModulesRegex.test(result[0]) && !overlappingRange) {
      updatedStack += stack.substring(lastIndex, result.index) + "<REDACTED: user-file-path>";
      lastIndex = fileRegex.lastIndex;
    }
  }
  if (lastIndex < stack.length) {
    updatedStack += stack.substr(lastIndex);
  }
  return updatedStack;
}
function removePropertiesWithPossibleUserInfo(property) {
  if (!property) {
    return property;
  }
  const userDataRegexes = [
    { label: "Google API Key", regex: /AIza[A-Za-z0-9_\\\-]{35}/ },
    { 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-]+/ }
    // Regex which matches @*.site
  ];
  for (const secretRegex of userDataRegexes) {
    if (secretRegex.regex.test(property)) {
      return `<REDACTED: ${secretRegex.label}>`;
    }
  }
  return property;
}
function $pw(data, cleanUpPatterns) {
  return $Nv(data, (value) => {
    if (value instanceof $bw || Object.hasOwnProperty.call(value, "isTrustedTelemetryValue")) {
      return value.value;
    }
    if (typeof value === "string") {
      let updatedProperty = value.replaceAll("%20", " ");
      updatedProperty = anonymizeFilePaths(updatedProperty, cleanUpPatterns);
      for (const regexp of cleanUpPatterns) {
        updatedProperty = updatedProperty.replace(regexp, "");
      }
      updatedProperty = removePropertiesWithPossibleUserInfo(updatedProperty);
      return updatedProperty;
    }
    return void 0;
  });
}
var $bw, $cw, $dw, $gw, $hw, telemetryAllowedAuthorities;
var init_telemetryUtils = __esm({
  "out-build/vs/platform/telemetry/common/telemetryUtils.js"() {
    "use strict";
    init_objects();
    init_types();
    init_remoteHosts();
    init_commonProperties();
    init_telemetry();
    $bw = class {
      constructor(value) {
        this.value = value;
        this.isTrustedTelemetryValue = true;
      }
    };
    $cw = 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 = false;
      }
      publicLog() {
      }
      publicLog2() {
      }
      publicLogError() {
      }
      publicLogError2() {
      }
      setExperimentProperty() {
      }
    };
    $dw = new $cw();
    $gw = "extensionTelemetryLog";
    $hw = { log: () => null, flush: () => Promise.resolve(void 0) };
    telemetryAllowedAuthorities = /* @__PURE__ */ new Set(["ssh-remote", "dev-container", "attached-container", "wsl", "tunnel", "codespaces", "amlext"]);
  }
});

// out-build/vs/platform/extensionManagement/common/extensionManagement.js
function $jA(targetPlatform) {
  switch (targetPlatform) {
    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 $kA(targetPlatform) {
  switch (targetPlatform) {
    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 $lA(platform, arch2) {
  switch (platform) {
    case 3:
      if (arch2 === "x64") {
        return "win32-x64";
      }
      if (arch2 === "arm64") {
        return "win32-arm64";
      }
      return "unknown";
    case 2:
      if (arch2 === "x64") {
        return "linux-x64";
      }
      if (arch2 === "arm64") {
        return "linux-arm64";
      }
      if (arch2 === "arm") {
        return "linux-armhf";
      }
      return "unknown";
    case "alpine":
      if (arch2 === "x64") {
        return "alpine-x64";
      }
      if (arch2 === "arm64") {
        return "alpine-arm64";
      }
      return "unknown";
    case 1:
      if (arch2 === "x64") {
        return "darwin-x64";
      }
      if (arch2 === "arm64") {
        return "darwin-arm64";
      }
      return "unknown";
    case 0:
      return "web";
  }
}
function $mA(allTargetPlatforms, productTargetPlatform) {
  return productTargetPlatform === "web" && !allTargetPlatforms.includes(
    "web"
    /* TargetPlatform.WEB */
  );
}
function $nA(extensionTargetPlatform, allTargetPlatforms, productTargetPlatform) {
  if ($mA(allTargetPlatforms, productTargetPlatform)) {
    return false;
  }
  if (extensionTargetPlatform === "undefined") {
    return true;
  }
  if (extensionTargetPlatform === "universal") {
    return true;
  }
  if (extensionTargetPlatform === "unknown") {
    return false;
  }
  if (extensionTargetPlatform === productTargetPlatform) {
    return true;
  }
  return false;
}
function $oA(thing) {
  return thing && typeof thing === "object" && typeof thing.id === "string" && (!thing.uuid || typeof thing.uuid === "string");
}
async function $yA(location2, fileService) {
  const stat = await fileService.resolve(location2);
  if (stat.children) {
    const sizes = await Promise.all(stat.children.map((c) => $yA(c.resource, fileService)));
    return sizes.reduce((r, s) => r + s, 0);
  }
  return stat.size ?? 0;
}
var $cA, $dA, $eA, $gA, $hA, $iA, ExtensionInstallSource, SortBy, SortOrder, StatisticType, InstallOperation, $pA, ExtensionGalleryErrorCode, $qA, ExtensionManagementErrorCode, ExtensionSignatureVerificationCode, $rA, $sA, $vA, $wA, $xA, $zA, $AA, $BA, $CA;
var init_extensionManagement = __esm({
  "out-build/vs/platform/extensionManagement/common/extensionManagement.js"() {
    "use strict";
    init_nls2();
    init_instantiation();
    $cA = "^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$";
    $dA = new RegExp($cA);
    $eA = "__web_extension";
    $gA = "extensionInstallSource";
    $hA = "dependecyOrPackExtensionInstall";
    $iA = "clientTargetPlatform";
    (function(ExtensionInstallSource2) {
      ExtensionInstallSource2["COMMAND"] = "command";
      ExtensionInstallSource2["SETTINGS_SYNC"] = "settingsSync";
    })(ExtensionInstallSource || (ExtensionInstallSource = {}));
    (function(SortBy2) {
      SortBy2[SortBy2["NoneOrRelevance"] = 0] = "NoneOrRelevance";
      SortBy2[SortBy2["LastUpdatedDate"] = 1] = "LastUpdatedDate";
      SortBy2[SortBy2["Title"] = 2] = "Title";
      SortBy2[SortBy2["PublisherName"] = 3] = "PublisherName";
      SortBy2[SortBy2["InstallCount"] = 4] = "InstallCount";
      SortBy2[SortBy2["PublishedDate"] = 10] = "PublishedDate";
      SortBy2[SortBy2["AverageRating"] = 6] = "AverageRating";
      SortBy2[SortBy2["WeightedRating"] = 12] = "WeightedRating";
    })(SortBy || (SortBy = {}));
    (function(SortOrder2) {
      SortOrder2[SortOrder2["Default"] = 0] = "Default";
      SortOrder2[SortOrder2["Ascending"] = 1] = "Ascending";
      SortOrder2[SortOrder2["Descending"] = 2] = "Descending";
    })(SortOrder || (SortOrder = {}));
    (function(StatisticType2) {
      StatisticType2["Install"] = "install";
      StatisticType2["Uninstall"] = "uninstall";
    })(StatisticType || (StatisticType = {}));
    (function(InstallOperation2) {
      InstallOperation2[InstallOperation2["None"] = 1] = "None";
      InstallOperation2[InstallOperation2["Install"] = 2] = "Install";
      InstallOperation2[InstallOperation2["Update"] = 3] = "Update";
      InstallOperation2[InstallOperation2["Migrate"] = 4] = "Migrate";
    })(InstallOperation || (InstallOperation = {}));
    $pA = $Qk("extensionGalleryService");
    (function(ExtensionGalleryErrorCode2) {
      ExtensionGalleryErrorCode2["Timeout"] = "Timeout";
      ExtensionGalleryErrorCode2["Cancelled"] = "Cancelled";
      ExtensionGalleryErrorCode2["Failed"] = "Failed";
      ExtensionGalleryErrorCode2["DownloadFailedWriting"] = "DownloadFailedWriting";
      ExtensionGalleryErrorCode2["Offline"] = "Offline";
    })(ExtensionGalleryErrorCode || (ExtensionGalleryErrorCode = {}));
    $qA = class extends Error {
      constructor(message, code) {
        super(message);
        this.code = code;
        this.name = code;
      }
    };
    (function(ExtensionManagementErrorCode2) {
      ExtensionManagementErrorCode2["Unsupported"] = "Unsupported";
      ExtensionManagementErrorCode2["Deprecated"] = "Deprecated";
      ExtensionManagementErrorCode2["Malicious"] = "Malicious";
      ExtensionManagementErrorCode2["Incompatible"] = "Incompatible";
      ExtensionManagementErrorCode2["IncompatibleApi"] = "IncompatibleApi";
      ExtensionManagementErrorCode2["IncompatibleTargetPlatform"] = "IncompatibleTargetPlatform";
      ExtensionManagementErrorCode2["ReleaseVersionNotFound"] = "ReleaseVersionNotFound";
      ExtensionManagementErrorCode2["Invalid"] = "Invalid";
      ExtensionManagementErrorCode2["Download"] = "Download";
      ExtensionManagementErrorCode2["DownloadSignature"] = "DownloadSignature";
      ExtensionManagementErrorCode2["DownloadFailedWriting"] = "DownloadFailedWriting";
      ExtensionManagementErrorCode2["UpdateMetadata"] = "UpdateMetadata";
      ExtensionManagementErrorCode2["Extract"] = "Extract";
      ExtensionManagementErrorCode2["Scanning"] = "Scanning";
      ExtensionManagementErrorCode2["ScanningExtension"] = "ScanningExtension";
      ExtensionManagementErrorCode2["ReadUninstalled"] = "ReadUninstalled";
      ExtensionManagementErrorCode2["UnsetUninstalled"] = "UnsetUninstalled";
      ExtensionManagementErrorCode2["Delete"] = "Delete";
      ExtensionManagementErrorCode2["Rename"] = "Rename";
      ExtensionManagementErrorCode2["IntializeDefaultProfile"] = "IntializeDefaultProfile";
      ExtensionManagementErrorCode2["AddToProfile"] = "AddToProfile";
      ExtensionManagementErrorCode2["InstalledExtensionNotFound"] = "InstalledExtensionNotFound";
      ExtensionManagementErrorCode2["PostInstall"] = "PostInstall";
      ExtensionManagementErrorCode2["CorruptZip"] = "CorruptZip";
      ExtensionManagementErrorCode2["IncompleteZip"] = "IncompleteZip";
      ExtensionManagementErrorCode2["PackageNotSigned"] = "PackageNotSigned";
      ExtensionManagementErrorCode2["SignatureVerificationInternal"] = "SignatureVerificationInternal";
      ExtensionManagementErrorCode2["SignatureVerificationFailed"] = "SignatureVerificationFailed";
      ExtensionManagementErrorCode2["NotAllowed"] = "NotAllowed";
      ExtensionManagementErrorCode2["Gallery"] = "Gallery";
      ExtensionManagementErrorCode2["Cancelled"] = "Cancelled";
      ExtensionManagementErrorCode2["Unknown"] = "Unknown";
      ExtensionManagementErrorCode2["Internal"] = "Internal";
    })(ExtensionManagementErrorCode || (ExtensionManagementErrorCode = {}));
    (function(ExtensionSignatureVerificationCode2) {
      ExtensionSignatureVerificationCode2["NotSigned"] = "NotSigned";
      ExtensionSignatureVerificationCode2["Success"] = "Success";
      ExtensionSignatureVerificationCode2["RequiredArgumentMissing"] = "RequiredArgumentMissing";
      ExtensionSignatureVerificationCode2["InvalidArgument"] = "InvalidArgument";
      ExtensionSignatureVerificationCode2["PackageIsUnreadable"] = "PackageIsUnreadable";
      ExtensionSignatureVerificationCode2["UnhandledException"] = "UnhandledException";
      ExtensionSignatureVerificationCode2["SignatureManifestIsMissing"] = "SignatureManifestIsMissing";
      ExtensionSignatureVerificationCode2["SignatureManifestIsUnreadable"] = "SignatureManifestIsUnreadable";
      ExtensionSignatureVerificationCode2["SignatureIsMissing"] = "SignatureIsMissing";
      ExtensionSignatureVerificationCode2["SignatureIsUnreadable"] = "SignatureIsUnreadable";
      ExtensionSignatureVerificationCode2["CertificateIsUnreadable"] = "CertificateIsUnreadable";
      ExtensionSignatureVerificationCode2["SignatureArchiveIsUnreadable"] = "SignatureArchiveIsUnreadable";
      ExtensionSignatureVerificationCode2["FileAlreadyExists"] = "FileAlreadyExists";
      ExtensionSignatureVerificationCode2["SignatureArchiveIsInvalidZip"] = "SignatureArchiveIsInvalidZip";
      ExtensionSignatureVerificationCode2["SignatureArchiveHasSameSignatureFile"] = "SignatureArchiveHasSameSignatureFile";
      ExtensionSignatureVerificationCode2["PackageIntegrityCheckFailed"] = "PackageIntegrityCheckFailed";
      ExtensionSignatureVerificationCode2["SignatureIsInvalid"] = "SignatureIsInvalid";
      ExtensionSignatureVerificationCode2["SignatureManifestIsInvalid"] = "SignatureManifestIsInvalid";
      ExtensionSignatureVerificationCode2["SignatureIntegrityCheckFailed"] = "SignatureIntegrityCheckFailed";
      ExtensionSignatureVerificationCode2["EntryIsMissing"] = "EntryIsMissing";
      ExtensionSignatureVerificationCode2["EntryIsTampered"] = "EntryIsTampered";
      ExtensionSignatureVerificationCode2["Untrusted"] = "Untrusted";
      ExtensionSignatureVerificationCode2["CertificateRevoked"] = "CertificateRevoked";
      ExtensionSignatureVerificationCode2["SignatureIsNotValid"] = "SignatureIsNotValid";
      ExtensionSignatureVerificationCode2["UnknownError"] = "UnknownError";
      ExtensionSignatureVerificationCode2["PackageIsInvalidZip"] = "PackageIsInvalidZip";
      ExtensionSignatureVerificationCode2["SignatureArchiveHasTooManyEntries"] = "SignatureArchiveHasTooManyEntries";
    })(ExtensionSignatureVerificationCode || (ExtensionSignatureVerificationCode = {}));
    $rA = class extends Error {
      constructor(message, code) {
        super(message);
        this.code = code;
        this.name = code;
      }
    };
    $sA = $Qk("extensionManagementService");
    $vA = $Qk("IGlobalExtensionEnablementService");
    $wA = $Qk("IExtensionTipsService");
    $xA = $Qk("IAllowedExtensionsService");
    $zA = localize2(1820, "Extensions");
    $AA = localize2(1821, "Preferences");
    $BA = "extensions.gallery.useUnpkgResourceApi";
    $CA = "extensions.allowed";
  }
});

// out-build/vs/base/parts/request/common/request.js
function $7u(error) {
  if (error instanceof $8u) {
    return true;
  }
  return error instanceof Error && error.name === offlineName && error.message === offlineName;
}
var offlineName, $8u;
var init_request2 = __esm({
  "out-build/vs/base/parts/request/common/request.js"() {
    "use strict";
    offlineName = "Offline";
    $8u = class extends Error {
      constructor() {
        super(offlineName);
        this.name = this.message;
      }
    };
  }
});

// out-build/vs/platform/extensions/common/extensions.js
function $8z(manifest) {
  return $9z(manifest);
}
function $9z(manifest) {
  return manifest.contributes && manifest.contributes.localizations ? manifest.contributes.localizations.length > 0 : false;
}
function $_z(enabledApiProposals) {
  return enabledApiProposals.map((proposal) => {
    const [proposalName, version] = proposal.split("@");
    return { proposalName, version: version ? parseInt(version) : void 0 };
  });
}
function $aA(enabledApiProposals) {
  return enabledApiProposals.map((proposal) => proposal.split("@")[0]);
}
var $Yz, $Zz, $1z, $4z, ExtensionType, TargetPlatform, $5z, $7z, $bA;
var init_extensions = __esm({
  "out-build/vs/platform/extensions/common/extensions.js"() {
    "use strict";
    init_strings();
    init_instantiation();
    init_remoteHosts();
    $Yz = "extensions.user.cache";
    $Zz = "extensions.builtin.cache";
    $1z = "undefined_publisher";
    $4z = [
      "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"
    ];
    (function(ExtensionType2) {
      ExtensionType2[ExtensionType2["System"] = 0] = "System";
      ExtensionType2[ExtensionType2["User"] = 1] = "User";
    })(ExtensionType || (ExtensionType = {}));
    (function(TargetPlatform2) {
      TargetPlatform2["WIN32_X64"] = "win32-x64";
      TargetPlatform2["WIN32_ARM64"] = "win32-arm64";
      TargetPlatform2["LINUX_X64"] = "linux-x64";
      TargetPlatform2["LINUX_ARM64"] = "linux-arm64";
      TargetPlatform2["LINUX_ARMHF"] = "linux-armhf";
      TargetPlatform2["ALPINE_X64"] = "alpine-x64";
      TargetPlatform2["ALPINE_ARM64"] = "alpine-arm64";
      TargetPlatform2["DARWIN_X64"] = "darwin-x64";
      TargetPlatform2["DARWIN_ARM64"] = "darwin-arm64";
      TargetPlatform2["WEB"] = "web";
      TargetPlatform2["UNIVERSAL"] = "universal";
      TargetPlatform2["UNKNOWN"] = "unknown";
      TargetPlatform2["UNDEFINED"] = "undefined";
    })(TargetPlatform || (TargetPlatform = {}));
    $5z = class {
      constructor(value) {
        this.value = value;
        this._lower = value.toLowerCase();
      }
      static equals(a, b) {
        if (typeof a === "undefined" || a === null) {
          return typeof b === "undefined" || b === null;
        }
        if (typeof b === "undefined" || b === null) {
          return false;
        }
        if (typeof a === "string" || typeof b === "string") {
          const aValue = typeof a === "string" ? a : a.value;
          const bValue = typeof b === "string" ? b : b.value;
          return $1f(aValue, bValue);
        }
        return a._lower === b._lower;
      }
      /**
       * Gives the value by which to index (for equality).
       */
      static toKey(id2) {
        if (typeof id2 === "string") {
          return id2.toLowerCase();
        }
        return id2._lower;
      }
    };
    $7z = class {
      constructor() {
        this.c = /* @__PURE__ */ new Map();
      }
      clear() {
        this.c.clear();
      }
      delete(id2) {
        this.c.delete($5z.toKey(id2));
      }
      get(id2) {
        return this.c.get($5z.toKey(id2));
      }
      has(id2) {
        return this.c.has($5z.toKey(id2));
      }
      set(id2, value) {
        this.c.set($5z.toKey(id2), value);
      }
      values() {
        return this.c.values();
      }
      forEach(callbackfn) {
        this.c.forEach(callbackfn);
      }
      [Symbol.iterator]() {
        return this.c[Symbol.iterator]();
      }
    };
    $bA = $Qk("IBuiltinExtensionsScannerService");
  }
});

// out-build/vs/platform/extensionManagement/common/extensionManagementUtil.js
function $DA(a, b) {
  if (a.uuid && b.uuid) {
    return a.uuid === b.uuid;
  }
  if (a.id === b.id) {
    return true;
  }
  return $Vf(a.id, b.id) === 0;
}
function $FA(id2) {
  const matches = EXTENSION_IDENTIFIER_WITH_VERSION_REGEX.exec(id2);
  if (matches && matches[1]) {
    return [$HA(matches[1]), matches[2]];
  }
  return [$HA(id2), void 0];
}
function $GA(publisher, name) {
  return `${publisher}.${name}`;
}
function $HA(id2) {
  return id2.toLowerCase();
}
function $IA(publisher, name) {
  return $HA($GA(publisher ?? $1z, name));
}
function $JA(extensions, getExtensionIdentifier) {
  const byExtension = [];
  const findGroup = (extension) => {
    for (const group of byExtension) {
      if (group.some((e) => $DA(getExtensionIdentifier(e), getExtensionIdentifier(extension)))) {
        return group;
      }
    }
    return null;
  };
  for (const extension of extensions) {
    const group = findGroup(extension);
    if (group) {
      group.push(extension);
    } else {
      byExtension.push([extension]);
    }
  }
  return byExtension;
}
function $KA(extension) {
  return {
    id: extension.identifier.id,
    name: extension.manifest.name,
    galleryId: null,
    publisherId: extension.publisherId,
    publisherName: extension.manifest.publisher,
    publisherDisplayName: extension.publisherDisplayName,
    dependencies: extension.manifest.extensionDependencies && extension.manifest.extensionDependencies.length > 0
  };
}
function $LA(extension) {
  return {
    id: new $bw(extension.identifier.id),
    name: new $bw(extension.name),
    extensionVersion: extension.version,
    galleryId: extension.identifier.uuid,
    publisherId: extension.publisherId,
    publisherName: extension.publisher,
    publisherDisplayName: extension.publisherDisplayName,
    isPreReleaseVersion: extension.properties.isPreReleaseVersion,
    dependencies: !!(extension.properties.dependencies && extension.properties.dependencies.length > 0),
    isSigned: extension.isSigned,
    ...extension.telemetryData
  };
}
async function isAlpineLinux(fileService, logService) {
  if (!$n) {
    return false;
  }
  let content;
  try {
    const fileContent = await fileService.readFile(URI.file("/etc/os-release"));
    content = fileContent.value.toString();
  } catch (error) {
    try {
      const fileContent = await fileService.readFile(URI.file("/usr/lib/os-release"));
      content = fileContent.value.toString();
    } catch (error2) {
      logService.debug(`Error while getting the os-release file.`, $qb(error2));
    }
  }
  return !!content && (content.match(/^ID=([^\u001b\r\n]*)/m) || [])[1] === "alpine";
}
async function $OA(fileService, logService) {
  const alpineLinux = await isAlpineLinux(fileService, logService);
  const targetPlatform = $lA(alpineLinux ? "alpine" : $x, $ic);
  logService.debug("ComputeTargetPlatform:", targetPlatform);
  return targetPlatform;
}
var ExtensionKeyRegex, $EA, EXTENSION_IDENTIFIER_WITH_VERSION_REGEX, $MA;
var init_extensionManagementUtil = __esm({
  "out-build/vs/platform/extensionManagement/common/extensionManagementUtil.js"() {
    "use strict";
    init_strings();
    init_extensionManagement();
    init_extensions();
    init_platform();
    init_uri();
    init_errors();
    init_process();
    init_telemetryUtils();
    ExtensionKeyRegex = /^([^.]+\..+)-(\d+\.\d+\.\d+)(-(.+))?$/;
    $EA = class _$EA {
      static create(extension) {
        const version = extension.manifest ? extension.manifest.version : extension.version;
        const targetPlatform = extension.manifest ? extension.targetPlatform : extension.properties.targetPlatform;
        return new _$EA(extension.identifier, version, targetPlatform);
      }
      static parse(key) {
        const matches = ExtensionKeyRegex.exec(key);
        return matches && matches[1] && matches[2] ? new _$EA({ id: matches[1] }, matches[2], matches[4] || void 0) : null;
      }
      constructor(identifier, version, targetPlatform = "undefined") {
        this.identifier = identifier;
        this.version = version;
        this.targetPlatform = targetPlatform;
        this.id = identifier.id;
      }
      toString() {
        return `${this.id}-${this.version}${this.targetPlatform !== "undefined" ? `-${this.targetPlatform}` : ""}`;
      }
      equals(o) {
        if (!(o instanceof _$EA)) {
          return false;
        }
        return $DA(this, o) && this.version === o.version && this.targetPlatform === o.targetPlatform;
      }
    };
    EXTENSION_IDENTIFIER_WITH_VERSION_REGEX = /^([^.]+\..+)@((prerelease)|(\d+\.\d+\.\d+(-.*)?))$/;
    $MA = new $5z("pprice.better-merge");
  }
});

// out-build/vs/base/common/severity.js
var Severity, severity_default;
var init_severity = __esm({
  "out-build/vs/base/common/severity.js"() {
    "use strict";
    init_strings();
    (function(Severity2) {
      Severity2[Severity2["Ignore"] = 0] = "Ignore";
      Severity2[Severity2["Info"] = 1] = "Info";
      Severity2[Severity2["Warning"] = 2] = "Warning";
      Severity2[Severity2["Error"] = 3] = "Error";
    })(Severity || (Severity = {}));
    (function(Severity2) {
      const _error = "error";
      const _warning = "warning";
      const _warn = "warn";
      const _info = "info";
      const _ignore = "ignore";
      function fromValue(value) {
        if (!value) {
          return Severity2.Ignore;
        }
        if ($1f(_error, value)) {
          return Severity2.Error;
        }
        if ($1f(_warning, value) || $1f(_warn, value)) {
          return Severity2.Warning;
        }
        if ($1f(_info, value)) {
          return Severity2.Info;
        }
        return Severity2.Ignore;
      }
      Severity2.fromValue = fromValue;
      function toString(severity) {
        switch (severity) {
          case Severity2.Error:
            return _error;
          case Severity2.Warning:
            return _warning;
          case Severity2.Info:
            return _info;
          default:
            return _ignore;
        }
      }
      Severity2.toString = toString;
    })(Severity || (Severity = {}));
    severity_default = Severity;
  }
});

// out-build/vs/base/common/semver/semver.js
var exports, module, SEMVER_SPEC_VERSION, parse, valid, coerce, clean, inc, major, minor, patch, prerelease, gt, gte, lt, lte, eq, neq, cmp3, compare2, rcompare, compareIdentifiers, rcompareIdentifiers, compareBuild, sort, rsort, diff, validRange, satisfies, maxSatisfying, minSatisfying, minVersion, gtr, ltr, outside, intersects, SemVer, Comparator, Range;
var init_semver = __esm({
  "out-build/vs/base/common/semver/semver.js"() {
    "use strict";
    exports = {};
    module = { exports };
    !function(e, r) {
      if ("object" == typeof exports && "object" == typeof module) module.exports = r();
      else if ("function" == typeof define && define.amd) define([], r);
      else {
        var t = r();
        for (var n in t) ("object" == typeof exports ? exports : e)[n] = t[n];
      }
    }("undefined" != typeof self ? self : void 0, function() {
      return function(e) {
        var r = {};
        function t(n) {
          if (r[n]) return r[n].exports;
          var o = r[n] = { i: n, l: false, exports: {} };
          return e[n].call(o.exports, o, o.exports, t), o.l = true, o.exports;
        }
        return t.m = e, t.c = r, t.d = function(e2, r2, n) {
          t.o(e2, r2) || Object.defineProperty(e2, r2, { enumerable: true, get: n });
        }, t.r = function(e2) {
          "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e2, "__esModule", { value: true });
        }, t.t = function(e2, r2) {
          if (1 & r2 && (e2 = t(e2)), 8 & r2) return e2;
          if (4 & r2 && "object" == typeof e2 && e2 && e2.__esModule) return e2;
          var n = /* @__PURE__ */ Object.create(null);
          if (t.r(n), Object.defineProperty(n, "default", { enumerable: true, value: e2 }), 2 & r2 && "string" != typeof e2) for (var o in e2) t.d(n, o, function(r3) {
            return e2[r3];
          }.bind(null, o));
          return n;
        }, t.n = function(e2) {
          var r2 = e2 && e2.__esModule ? function() {
            return e2.default;
          } : function() {
            return e2;
          };
          return t.d(r2, "a", r2), r2;
        }, t.o = function(e2, r2) {
          return Object.prototype.hasOwnProperty.call(e2, r2);
        }, t.p = "", t(t.s = 0);
      }([function(e, r, t) {
        (function(t2) {
          var n;
          r = e.exports = H, n = "object" == typeof t2 && t2.env && t2.env.NODE_DEBUG && /\bsemver\b/i.test(t2.env.NODE_DEBUG) ? function() {
            var e2 = Array.prototype.slice.call(arguments, 0);
            e2.unshift("SEMVER"), console.log.apply(console, e2);
          } : function() {
          }, r.SEMVER_SPEC_VERSION = "2.0.0";
          var o = 256, i = Number.MAX_SAFE_INTEGER || 9007199254740991, s = r.re = [], a = r.src = [], u = 0, c = u++;
          a[c] = "0|[1-9]\\d*";
          var p = u++;
          a[p] = "[0-9]+";
          var f = u++;
          a[f] = "\\d*[a-zA-Z-][a-zA-Z0-9-]*";
          var l = u++;
          a[l] = "(" + a[c] + ")\\.(" + a[c] + ")\\.(" + a[c] + ")";
          var h = u++;
          a[h] = "(" + a[p] + ")\\.(" + a[p] + ")\\.(" + a[p] + ")";
          var v = u++;
          a[v] = "(?:" + a[c] + "|" + a[f] + ")";
          var m = u++;
          a[m] = "(?:" + a[p] + "|" + a[f] + ")";
          var w = u++;
          a[w] = "(?:-(" + a[v] + "(?:\\." + a[v] + ")*))";
          var g = u++;
          a[g] = "(?:-?(" + a[m] + "(?:\\." + a[m] + ")*))";
          var y = u++;
          a[y] = "[0-9A-Za-z-]+";
          var d = u++;
          a[d] = "(?:\\+(" + a[y] + "(?:\\." + a[y] + ")*))";
          var b = u++, j = "v?" + a[l] + a[w] + "?" + a[d] + "?";
          a[b] = "^" + j + "$";
          var E = "[v=\\s]*" + a[h] + a[g] + "?" + a[d] + "?", T = u++;
          a[T] = "^" + E + "$";
          var x = u++;
          a[x] = "((?:<|>)?=?)";
          var $ = u++;
          a[$] = a[p] + "|x|X|\\*";
          var k = u++;
          a[k] = a[c] + "|x|X|\\*";
          var S = u++;
          a[S] = "[v=\\s]*(" + a[k] + ")(?:\\.(" + a[k] + ")(?:\\.(" + a[k] + ")(?:" + a[w] + ")?" + a[d] + "?)?)?";
          var R = u++;
          a[R] = "[v=\\s]*(" + a[$] + ")(?:\\.(" + a[$] + ")(?:\\.(" + a[$] + ")(?:" + a[g] + ")?" + a[d] + "?)?)?";
          var I = u++;
          a[I] = "^" + a[x] + "\\s*" + a[S] + "$";
          var _ = u++;
          a[_] = "^" + a[x] + "\\s*" + a[R] + "$";
          var O = u++;
          a[O] = "(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";
          var A = u++;
          a[A] = "(?:~>?)";
          var M = u++;
          a[M] = "(\\s*)" + a[A] + "\\s+", s[M] = new RegExp(a[M], "g");
          var V = u++;
          a[V] = "^" + a[A] + a[S] + "$";
          var P = u++;
          a[P] = "^" + a[A] + a[R] + "$";
          var C = u++;
          a[C] = "(?:\\^)";
          var L = u++;
          a[L] = "(\\s*)" + a[C] + "\\s+", s[L] = new RegExp(a[L], "g");
          var N = u++;
          a[N] = "^" + a[C] + a[S] + "$";
          var q = u++;
          a[q] = "^" + a[C] + a[R] + "$";
          var D = u++;
          a[D] = "^" + a[x] + "\\s*(" + E + ")$|^$";
          var X = u++;
          a[X] = "^" + a[x] + "\\s*(" + j + ")$|^$";
          var z = u++;
          a[z] = "(\\s*)" + a[x] + "\\s*(" + E + "|" + a[S] + ")", s[z] = new RegExp(a[z], "g");
          var G = u++;
          a[G] = "^\\s*(" + a[S] + ")\\s+-\\s+(" + a[S] + ")\\s*$";
          var Z = u++;
          a[Z] = "^\\s*(" + a[R] + ")\\s+-\\s+(" + a[R] + ")\\s*$";
          var B = u++;
          a[B] = "(<|>)?=?\\s*\\*";
          for (var U = 0; U < 35; U++) n(U, a[U]), s[U] || (s[U] = new RegExp(a[U]));
          function F(e2, r2) {
            if (e2 instanceof H) return e2;
            if ("string" != typeof e2) return null;
            if (e2.length > o) return null;
            if (!(r2 ? s[T] : s[b]).test(e2)) return null;
            try {
              return new H(e2, r2);
            } catch (e3) {
              return null;
            }
          }
          function H(e2, r2) {
            if (e2 instanceof H) {
              if (e2.loose === r2) return e2;
              e2 = e2.version;
            } else if ("string" != typeof e2) throw new TypeError("Invalid Version: " + e2);
            if (e2.length > o) throw new TypeError("version is longer than " + o + " characters");
            if (!(this instanceof H)) return new H(e2, r2);
            n("SemVer", e2, r2), this.loose = r2;
            var t3 = e2.trim().match(r2 ? s[T] : s[b]);
            if (!t3) throw new TypeError("Invalid Version: " + e2);
            if (this.raw = e2, this.major = +t3[1], this.minor = +t3[2], this.patch = +t3[3], this.major > i || this.major < 0) throw new TypeError("Invalid major version");
            if (this.minor > i || this.minor < 0) throw new TypeError("Invalid minor version");
            if (this.patch > i || this.patch < 0) throw new TypeError("Invalid patch version");
            t3[4] ? this.prerelease = t3[4].split(".").map(function(e3) {
              if (/^[0-9]+$/.test(e3)) {
                var r3 = +e3;
                if (r3 >= 0 && r3 < i) return r3;
              }
              return e3;
            }) : this.prerelease = [], this.build = t3[5] ? t3[5].split(".") : [], this.format();
          }
          r.parse = F, r.valid = function(e2, r2) {
            var t3 = F(e2, r2);
            return t3 ? t3.version : null;
          }, r.clean = function(e2, r2) {
            var t3 = F(e2.trim().replace(/^[=v]+/, ""), r2);
            return t3 ? t3.version : null;
          }, r.SemVer = H, H.prototype.format = function() {
            return this.version = this.major + "." + this.minor + "." + this.patch, this.prerelease.length && (this.version += "-" + this.prerelease.join(".")), this.version;
          }, H.prototype.toString = function() {
            return this.version;
          }, H.prototype.compare = function(e2) {
            return n("SemVer.compare", this.version, this.loose, e2), e2 instanceof H || (e2 = new H(e2, this.loose)), this.compareMain(e2) || this.comparePre(e2);
          }, H.prototype.compareMain = function(e2) {
            return e2 instanceof H || (e2 = new H(e2, this.loose)), K(this.major, e2.major) || K(this.minor, e2.minor) || K(this.patch, e2.patch);
          }, H.prototype.comparePre = function(e2) {
            if (e2 instanceof H || (e2 = new H(e2, this.loose)), this.prerelease.length && !e2.prerelease.length) return -1;
            if (!this.prerelease.length && e2.prerelease.length) return 1;
            if (!this.prerelease.length && !e2.prerelease.length) return 0;
            var r2 = 0;
            do {
              var t3 = this.prerelease[r2], o2 = e2.prerelease[r2];
              if (n("prerelease compare", r2, t3, o2), void 0 === t3 && void 0 === o2) return 0;
              if (void 0 === o2) return 1;
              if (void 0 === t3) return -1;
              if (t3 !== o2) return K(t3, o2);
            } while (++r2);
          }, H.prototype.inc = function(e2, r2) {
            switch (e2) {
              case "premajor":
                this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", r2);
                break;
              case "preminor":
                this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", r2);
                break;
              case "prepatch":
                this.prerelease.length = 0, this.inc("patch", r2), this.inc("pre", r2);
                break;
              case "prerelease":
                0 === this.prerelease.length && this.inc("patch", r2), this.inc("pre", r2);
                break;
              case "major":
                0 === this.minor && 0 === this.patch && 0 !== this.prerelease.length || this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
                break;
              case "minor":
                0 === this.patch && 0 !== this.prerelease.length || this.minor++, this.patch = 0, this.prerelease = [];
                break;
              case "patch":
                0 === this.prerelease.length && this.patch++, this.prerelease = [];
                break;
              case "pre":
                if (0 === this.prerelease.length) this.prerelease = [0];
                else {
                  for (var t3 = this.prerelease.length; --t3 >= 0; ) "number" == typeof this.prerelease[t3] && (this.prerelease[t3]++, t3 = -2);
                  -1 === t3 && this.prerelease.push(0);
                }
                r2 && (this.prerelease[0] === r2 ? isNaN(this.prerelease[1]) && (this.prerelease = [r2, 0]) : this.prerelease = [r2, 0]);
                break;
              default:
                throw new Error("invalid increment argument: " + e2);
            }
            return this.format(), this.raw = this.version, this;
          }, r.inc = function(e2, r2, t3, n2) {
            "string" == typeof t3 && (n2 = t3, t3 = void 0);
            try {
              return new H(e2, t3).inc(r2, n2).version;
            } catch (e3) {
              return null;
            }
          }, r.diff = function(e2, r2) {
            if (ee(e2, r2)) return null;
            var t3 = F(e2), n2 = F(r2);
            if (t3.prerelease.length || n2.prerelease.length) {
              for (var o2 in t3) if (("major" === o2 || "minor" === o2 || "patch" === o2) && t3[o2] !== n2[o2]) return "pre" + o2;
              return "prerelease";
            }
            for (var o2 in t3) if (("major" === o2 || "minor" === o2 || "patch" === o2) && t3[o2] !== n2[o2]) return o2;
          }, r.compareIdentifiers = K;
          var J = /^[0-9]+$/;
          function K(e2, r2) {
            var t3 = J.test(e2), n2 = J.test(r2);
            return t3 && n2 && (e2 = +e2, r2 = +r2), t3 && !n2 ? -1 : n2 && !t3 ? 1 : e2 < r2 ? -1 : e2 > r2 ? 1 : 0;
          }
          function Q(e2, r2, t3) {
            return new H(e2, t3).compare(new H(r2, t3));
          }
          function W(e2, r2, t3) {
            return Q(e2, r2, t3) > 0;
          }
          function Y(e2, r2, t3) {
            return Q(e2, r2, t3) < 0;
          }
          function ee(e2, r2, t3) {
            return 0 === Q(e2, r2, t3);
          }
          function re(e2, r2, t3) {
            return 0 !== Q(e2, r2, t3);
          }
          function te(e2, r2, t3) {
            return Q(e2, r2, t3) >= 0;
          }
          function ne(e2, r2, t3) {
            return Q(e2, r2, t3) <= 0;
          }
          function oe(e2, r2, t3, n2) {
            var o2;
            switch (r2) {
              case "===":
                "object" == typeof e2 && (e2 = e2.version), "object" == typeof t3 && (t3 = t3.version), o2 = e2 === t3;
                break;
              case "!==":
                "object" == typeof e2 && (e2 = e2.version), "object" == typeof t3 && (t3 = t3.version), o2 = e2 !== t3;
                break;
              case "":
              case "=":
              case "==":
                o2 = ee(e2, t3, n2);
                break;
              case "!=":
                o2 = re(e2, t3, n2);
                break;
              case ">":
                o2 = W(e2, t3, n2);
                break;
              case ">=":
                o2 = te(e2, t3, n2);
                break;
              case "<":
                o2 = Y(e2, t3, n2);
                break;
              case "<=":
                o2 = ne(e2, t3, n2);
                break;
              default:
                throw new TypeError("Invalid operator: " + r2);
            }
            return o2;
          }
          function ie(e2, r2) {
            if (e2 instanceof ie) {
              if (e2.loose === r2) return e2;
              e2 = e2.value;
            }
            if (!(this instanceof ie)) return new ie(e2, r2);
            n("comparator", e2, r2), this.loose = r2, this.parse(e2), this.semver === se ? this.value = "" : this.value = this.operator + this.semver.version, n("comp", this);
          }
          r.rcompareIdentifiers = function(e2, r2) {
            return K(r2, e2);
          }, r.major = function(e2, r2) {
            return new H(e2, r2).major;
          }, r.minor = function(e2, r2) {
            return new H(e2, r2).minor;
          }, r.patch = function(e2, r2) {
            return new H(e2, r2).patch;
          }, r.compare = Q, r.compareLoose = function(e2, r2) {
            return Q(e2, r2, true);
          }, r.rcompare = function(e2, r2, t3) {
            return Q(r2, e2, t3);
          }, r.sort = function(e2, t3) {
            return e2.sort(function(e3, n2) {
              return r.compare(e3, n2, t3);
            });
          }, r.rsort = function(e2, t3) {
            return e2.sort(function(e3, n2) {
              return r.rcompare(e3, n2, t3);
            });
          }, r.gt = W, r.lt = Y, r.eq = ee, r.neq = re, r.gte = te, r.lte = ne, r.cmp = oe, r.Comparator = ie;
          var se = {};
          function ae(e2, r2) {
            if (e2 instanceof ae) return e2.loose === r2 ? e2 : new ae(e2.raw, r2);
            if (e2 instanceof ie) return new ae(e2.value, r2);
            if (!(this instanceof ae)) return new ae(e2, r2);
            if (this.loose = r2, this.raw = e2, this.set = e2.split(/\s*\|\|\s*/).map(function(e3) {
              return this.parseRange(e3.trim());
            }, this).filter(function(e3) {
              return e3.length;
            }), !this.set.length) throw new TypeError("Invalid SemVer Range: " + e2);
            this.format();
          }
          function ue(e2) {
            return !e2 || "x" === e2.toLowerCase() || "*" === e2;
          }
          function ce(e2, r2, t3, n2, o2, i2, s2, a2, u2, c2, p2, f2, l2) {
            return ((r2 = ue(t3) ? "" : ue(n2) ? ">=" + t3 + ".0.0" : ue(o2) ? ">=" + t3 + "." + n2 + ".0" : ">=" + r2) + " " + (a2 = ue(u2) ? "" : ue(c2) ? "<" + (+u2 + 1) + ".0.0" : ue(p2) ? "<" + u2 + "." + (+c2 + 1) + ".0" : f2 ? "<=" + u2 + "." + c2 + "." + p2 + "-" + f2 : "<=" + a2)).trim();
          }
          function pe(e2, r2) {
            for (var t3 = 0; t3 < e2.length; t3++) if (!e2[t3].test(r2)) return false;
            if (r2.prerelease.length) {
              for (t3 = 0; t3 < e2.length; t3++) if (n(e2[t3].semver), e2[t3].semver !== se && e2[t3].semver.prerelease.length > 0) {
                var o2 = e2[t3].semver;
                if (o2.major === r2.major && o2.minor === r2.minor && o2.patch === r2.patch) return true;
              }
              return false;
            }
            return true;
          }
          function fe(e2, r2, t3) {
            try {
              r2 = new ae(r2, t3);
            } catch (e3) {
              return false;
            }
            return r2.test(e2);
          }
          function le(e2, r2, t3, n2) {
            var o2, i2, s2, a2, u2;
            switch (e2 = new H(e2, n2), r2 = new ae(r2, n2), t3) {
              case ">":
                o2 = W, i2 = ne, s2 = Y, a2 = ">", u2 = ">=";
                break;
              case "<":
                o2 = Y, i2 = te, s2 = W, a2 = "<", u2 = "<=";
                break;
              default:
                throw new TypeError('Must provide a hilo val of "<" or ">"');
            }
            if (fe(e2, r2, n2)) return false;
            for (var c2 = 0; c2 < r2.set.length; ++c2) {
              var p2 = r2.set[c2], f2 = null, l2 = null;
              if (p2.forEach(function(e3) {
                e3.semver === se && (e3 = new ie(">=0.0.0")), f2 = f2 || e3, l2 = l2 || e3, o2(e3.semver, f2.semver, n2) ? f2 = e3 : s2(e3.semver, l2.semver, n2) && (l2 = e3);
              }), f2.operator === a2 || f2.operator === u2) return false;
              if ((!l2.operator || l2.operator === a2) && i2(e2, l2.semver)) return false;
              if (l2.operator === u2 && s2(e2, l2.semver)) return false;
            }
            return true;
          }
          ie.prototype.parse = function(e2) {
            var r2 = this.loose ? s[D] : s[X], t3 = e2.match(r2);
            if (!t3) throw new TypeError("Invalid comparator: " + e2);
            this.operator = t3[1], "=" === this.operator && (this.operator = ""), t3[2] ? this.semver = new H(t3[2], this.loose) : this.semver = se;
          }, ie.prototype.toString = function() {
            return this.value;
          }, ie.prototype.test = function(e2) {
            return n("Comparator.test", e2, this.loose), this.semver === se || ("string" == typeof e2 && (e2 = new H(e2, this.loose)), oe(e2, this.operator, this.semver, this.loose));
          }, ie.prototype.intersects = function(e2, r2) {
            if (!(e2 instanceof ie)) throw new TypeError("a Comparator is required");
            var t3;
            if ("" === this.operator) return t3 = new ae(e2.value, r2), fe(this.value, t3, r2);
            if ("" === e2.operator) return t3 = new ae(this.value, r2), fe(e2.semver, t3, r2);
            var n2 = !(">=" !== this.operator && ">" !== this.operator || ">=" !== e2.operator && ">" !== e2.operator), o2 = !("<=" !== this.operator && "<" !== this.operator || "<=" !== e2.operator && "<" !== e2.operator), i2 = this.semver.version === e2.semver.version, s2 = !(">=" !== this.operator && "<=" !== this.operator || ">=" !== e2.operator && "<=" !== e2.operator), a2 = oe(this.semver, "<", e2.semver, r2) && (">=" === this.operator || ">" === this.operator) && ("<=" === e2.operator || "<" === e2.operator), u2 = oe(this.semver, ">", e2.semver, r2) && ("<=" === this.operator || "<" === this.operator) && (">=" === e2.operator || ">" === e2.operator);
            return n2 || o2 || i2 && s2 || a2 || u2;
          }, r.Range = ae, ae.prototype.format = function() {
            return this.range = this.set.map(function(e2) {
              return e2.join(" ").trim();
            }).join("||").trim(), this.range;
          }, ae.prototype.toString = function() {
            return this.range;
          }, ae.prototype.parseRange = function(e2) {
            var r2 = this.loose;
            e2 = e2.trim(), n("range", e2, r2);
            var t3 = r2 ? s[Z] : s[G];
            e2 = e2.replace(t3, ce), n("hyphen replace", e2), e2 = e2.replace(s[z], "$1$2$3"), n("comparator trim", e2, s[z]), e2 = (e2 = (e2 = e2.replace(s[M], "$1~")).replace(s[L], "$1^")).split(/\s+/).join(" ");
            var o2 = r2 ? s[D] : s[X], i2 = e2.split(" ").map(function(e3) {
              return function(e4, r3) {
                return n("comp", e4), e4 = function(e5, r4) {
                  return e5.trim().split(/\s+/).map(function(e6) {
                    return function(e7, r5) {
                      n("caret", e7, r5);
                      var t4 = r5 ? s[q] : s[N];
                      return e7.replace(t4, function(r6, t5, o3, i3, s2) {
                        var a2;
                        return n("caret", e7, r6, t5, o3, i3, s2), ue(t5) ? a2 = "" : ue(o3) ? a2 = ">=" + t5 + ".0.0 <" + (+t5 + 1) + ".0.0" : ue(i3) ? a2 = "0" === t5 ? ">=" + t5 + "." + o3 + ".0 <" + t5 + "." + (+o3 + 1) + ".0" : ">=" + t5 + "." + o3 + ".0 <" + (+t5 + 1) + ".0.0" : s2 ? (n("replaceCaret pr", s2), "-" !== s2.charAt(0) && (s2 = "-" + s2), a2 = "0" === t5 ? "0" === o3 ? ">=" + t5 + "." + o3 + "." + i3 + s2 + " <" + t5 + "." + o3 + "." + (+i3 + 1) : ">=" + t5 + "." + o3 + "." + i3 + s2 + " <" + t5 + "." + (+o3 + 1) + ".0" : ">=" + t5 + "." + o3 + "." + i3 + s2 + " <" + (+t5 + 1) + ".0.0") : (n("no pr"), a2 = "0" === t5 ? "0" === o3 ? ">=" + t5 + "." + o3 + "." + i3 + " <" + t5 + "." + o3 + "." + (+i3 + 1) : ">=" + t5 + "." + o3 + "." + i3 + " <" + t5 + "." + (+o3 + 1) + ".0" : ">=" + t5 + "." + o3 + "." + i3 + " <" + (+t5 + 1) + ".0.0"), n("caret return", a2), a2;
                      });
                    }(e6, r4);
                  }).join(" ");
                }(e4, r3), n("caret", e4), e4 = function(e5, r4) {
                  return e5.trim().split(/\s+/).map(function(e6) {
                    return function(e7, r5) {
                      var t4 = r5 ? s[P] : s[V];
                      return e7.replace(t4, function(r6, t5, o3, i3, s2) {
                        var a2;
                        return n("tilde", e7, r6, t5, o3, i3, s2), ue(t5) ? a2 = "" : ue(o3) ? a2 = ">=" + t5 + ".0.0 <" + (+t5 + 1) + ".0.0" : ue(i3) ? a2 = ">=" + t5 + "." + o3 + ".0 <" + t5 + "." + (+o3 + 1) + ".0" : s2 ? (n("replaceTilde pr", s2), "-" !== s2.charAt(0) && (s2 = "-" + s2), a2 = ">=" + t5 + "." + o3 + "." + i3 + s2 + " <" + t5 + "." + (+o3 + 1) + ".0") : a2 = ">=" + t5 + "." + o3 + "." + i3 + " <" + t5 + "." + (+o3 + 1) + ".0", n("tilde return", a2), a2;
                      });
                    }(e6, r4);
                  }).join(" ");
                }(e4, r3), n("tildes", e4), e4 = function(e5, r4) {
                  return n("replaceXRanges", e5, r4), e5.split(/\s+/).map(function(e6) {
                    return function(e7, r5) {
                      e7 = e7.trim();
                      var t4 = r5 ? s[_] : s[I];
                      return e7.replace(t4, function(r6, t5, o3, i3, s2, a2) {
                        n("xRange", e7, r6, t5, o3, i3, s2, a2);
                        var u2 = ue(o3), c2 = u2 || ue(i3), p2 = c2 || ue(s2);
                        return "=" === t5 && p2 && (t5 = ""), u2 ? r6 = ">" === t5 || "<" === t5 ? "<0.0.0" : "*" : t5 && p2 ? (c2 && (i3 = 0), p2 && (s2 = 0), ">" === t5 ? (t5 = ">=", c2 ? (o3 = +o3 + 1, i3 = 0, s2 = 0) : p2 && (i3 = +i3 + 1, s2 = 0)) : "<=" === t5 && (t5 = "<", c2 ? o3 = +o3 + 1 : i3 = +i3 + 1), r6 = t5 + o3 + "." + i3 + "." + s2) : c2 ? r6 = ">=" + o3 + ".0.0 <" + (+o3 + 1) + ".0.0" : p2 && (r6 = ">=" + o3 + "." + i3 + ".0 <" + o3 + "." + (+i3 + 1) + ".0"), n("xRange return", r6), r6;
                      });
                    }(e6, r4);
                  }).join(" ");
                }(e4, r3), n("xrange", e4), e4 = function(e5, r4) {
                  return n("replaceStars", e5, r4), e5.trim().replace(s[B], "");
                }(e4, r3), n("stars", e4), e4;
              }(e3, r2);
            }).join(" ").split(/\s+/);
            return this.loose && (i2 = i2.filter(function(e3) {
              return !!e3.match(o2);
            })), i2 = i2.map(function(e3) {
              return new ie(e3, r2);
            });
          }, ae.prototype.intersects = function(e2, r2) {
            if (!(e2 instanceof ae)) throw new TypeError("a Range is required");
            return this.set.some(function(t3) {
              return t3.every(function(t4) {
                return e2.set.some(function(e3) {
                  return e3.every(function(e4) {
                    return t4.intersects(e4, r2);
                  });
                });
              });
            });
          }, r.toComparators = function(e2, r2) {
            return new ae(e2, r2).set.map(function(e3) {
              return e3.map(function(e4) {
                return e4.value;
              }).join(" ").trim().split(" ");
            });
          }, ae.prototype.test = function(e2) {
            if (!e2) return false;
            "string" == typeof e2 && (e2 = new H(e2, this.loose));
            for (var r2 = 0; r2 < this.set.length; r2++) if (pe(this.set[r2], e2)) return true;
            return false;
          }, r.satisfies = fe, r.maxSatisfying = function(e2, r2, t3) {
            var n2 = null, o2 = null;
            try {
              var i2 = new ae(r2, t3);
            } catch (e3) {
              return null;
            }
            return e2.forEach(function(e3) {
              i2.test(e3) && (n2 && -1 !== o2.compare(e3) || (o2 = new H(n2 = e3, t3)));
            }), n2;
          }, r.minSatisfying = function(e2, r2, t3) {
            var n2 = null, o2 = null;
            try {
              var i2 = new ae(r2, t3);
            } catch (e3) {
              return null;
            }
            return e2.forEach(function(e3) {
              i2.test(e3) && (n2 && 1 !== o2.compare(e3) || (o2 = new H(n2 = e3, t3)));
            }), n2;
          }, r.validRange = function(e2, r2) {
            try {
              return new ae(e2, r2).range || "*";
            } catch (e3) {
              return null;
            }
          }, r.ltr = function(e2, r2, t3) {
            return le(e2, r2, "<", t3);
          }, r.gtr = function(e2, r2, t3) {
            return le(e2, r2, ">", t3);
          }, r.outside = le, r.prerelease = function(e2, r2) {
            var t3 = F(e2, r2);
            return t3 && t3.prerelease.length ? t3.prerelease : null;
          }, r.intersects = function(e2, r2, t3) {
            return e2 = new ae(e2, t3), r2 = new ae(r2, t3), e2.intersects(r2);
          }, r.coerce = function(e2) {
            if (e2 instanceof H) return e2;
            if ("string" != typeof e2) return null;
            var r2 = e2.match(s[O]);
            return null == r2 ? null : F((r2[1] || "0") + "." + (r2[2] || "0") + "." + (r2[3] || "0"));
          };
        }).call(this, t(1));
      }, function(e, r) {
        var t, n, o = e.exports = {};
        function i() {
          throw new Error("setTimeout has not been defined");
        }
        function s() {
          throw new Error("clearTimeout has not been defined");
        }
        function a(e2) {
          if (t === setTimeout) return setTimeout(e2, 0);
          if ((t === i || !t) && setTimeout) return t = setTimeout, setTimeout(e2, 0);
          try {
            return t(e2, 0);
          } catch (r2) {
            try {
              return t.call(null, e2, 0);
            } catch (r3) {
              return t.call(this, e2, 0);
            }
          }
        }
        !function() {
          try {
            t = "function" == typeof setTimeout ? setTimeout : i;
          } catch (e2) {
            t = i;
          }
          try {
            n = "function" == typeof clearTimeout ? clearTimeout : s;
          } catch (e2) {
            n = s;
          }
        }();
        var u, c = [], p = false, f = -1;
        function l() {
          p && u && (p = false, u.length ? c = u.concat(c) : f = -1, c.length && h());
        }
        function h() {
          if (!p) {
            var e2 = a(l);
            p = true;
            for (var r2 = c.length; r2; ) {
              for (u = c, c = []; ++f < r2; ) u && u[f].run();
              f = -1, r2 = c.length;
            }
            u = null, p = false, function(e3) {
              if (n === clearTimeout) return clearTimeout(e3);
              if ((n === s || !n) && clearTimeout) return n = clearTimeout, clearTimeout(e3);
              try {
                n(e3);
              } catch (r3) {
                try {
                  return n.call(null, e3);
                } catch (r4) {
                  return n.call(this, e3);
                }
              }
            }(e2);
          }
        }
        function v(e2, r2) {
          this.fun = e2, this.array = r2;
        }
        function m() {
        }
        o.nextTick = function(e2) {
          var r2 = new Array(arguments.length - 1);
          if (arguments.length > 1) for (var t2 = 1; t2 < arguments.length; t2++) r2[t2 - 1] = arguments[t2];
          c.push(new v(e2, r2)), 1 !== c.length || p || a(h);
        }, v.prototype.run = function() {
          this.fun.apply(null, this.array);
        }, o.title = "browser", o.browser = true, o.env = {}, o.argv = [], o.version = "", o.versions = {}, o.on = m, o.addListener = m, o.once = m, o.off = m, o.removeListener = m, o.removeAllListeners = m, o.emit = m, o.prependListener = m, o.prependOnceListener = m, o.listeners = function(e2) {
          return [];
        }, o.binding = function(e2) {
          throw new Error("process.binding is not supported");
        }, o.cwd = function() {
          return "/";
        }, o.chdir = function(e2) {
          throw new Error("process.chdir is not supported");
        }, o.umask = function() {
          return 0;
        };
      }]);
    });
    SEMVER_SPEC_VERSION = module.exports.SEMVER_SPEC_VERSION;
    parse = module.exports.parse;
    valid = module.exports.valid;
    coerce = module.exports.coerce;
    clean = module.exports.clean;
    inc = module.exports.inc;
    major = module.exports.major;
    minor = module.exports.minor;
    patch = module.exports.patch;
    prerelease = module.exports.prerelease;
    gt = module.exports.gt;
    gte = module.exports.gte;
    lt = module.exports.lt;
    lte = module.exports.lte;
    eq = module.exports.eq;
    neq = module.exports.neq;
    cmp3 = module.exports.cmp;
    compare2 = module.exports.compare;
    rcompare = module.exports.rcompare;
    compareIdentifiers = module.exports.compareIdentifiers;
    rcompareIdentifiers = module.exports.rcompareIdentifiers;
    compareBuild = module.exports.compareBuild;
    sort = module.exports.sort;
    rsort = module.exports.rsort;
    diff = module.exports.diff;
    validRange = module.exports.validRange;
    satisfies = module.exports.satisfies;
    maxSatisfying = module.exports.maxSatisfying;
    minSatisfying = module.exports.minSatisfying;
    minVersion = module.exports.minVersion;
    gtr = module.exports.gtr;
    ltr = module.exports.ltr;
    outside = module.exports.outside;
    intersects = module.exports.intersects;
    SemVer = module.exports.SemVer;
    Comparator = module.exports.Comparator;
    Range = module.exports.Range;
  }
});

// out-build/vs/platform/extensions/common/extensionsApiProposals.js
var _allApiProposals, allApiProposals;
var init_extensionsApiProposals = __esm({
  "out-build/vs/platform/extensions/common/extensionsApiProposals.js"() {
    "use strict";
    _allApiProposals = {
      activeComment: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.activeComment.d.ts"
      },
      aiRelatedInformation: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiRelatedInformation.d.ts"
      },
      aiTextSearchProvider: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts",
        version: 2
      },
      authLearnMore: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authLearnMore.d.ts"
      },
      authSession: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts"
      },
      canonicalUriProvider: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts"
      },
      chatEditing: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatEditing.d.ts"
      },
      chatParticipantAdditions: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts"
      },
      chatParticipantPrivate: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts",
        version: 2
      },
      chatProvider: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatProvider.d.ts"
      },
      chatReferenceBinaryData: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts"
      },
      chatTab: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatTab.d.ts"
      },
      chatVariableResolver: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatVariableResolver.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"
      },
      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"
      },
      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"
      },
      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"
      },
      createFileSystemWatcher: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.createFileSystemWatcher.d.ts"
      },
      customEditorMove: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorMove.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: 2
      },
      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"
      },
      documentFiltersExclusive: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts"
      },
      documentPaste: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentPaste.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"
      },
      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"
      },
      fileComments: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileComments.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"
      },
      idToken: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.idToken.d.ts"
      },
      inlineCompletionsAdditions: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts"
      },
      inlineEdit: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineEdit.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"
      },
      languageModelSystem: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelSystem.d.ts"
      },
      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"
      },
      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"
      },
      notebookCellExecutionState: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecutionState.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"
      },
      quickInputButtonLocation: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickInputButtonLocation.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"
      },
      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"
      },
      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"
      },
      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"
      },
      showLocal: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.showLocal.d.ts"
      },
      speech: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.speech.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"
      },
      taskPresentationGroup: {
        proposal: "https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskPresentationGroup.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"
      },
      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"
      },
      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"
      },
      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"
      }
    };
    allApiProposals = Object.freeze(_allApiProposals);
  }
});

// out-build/vs/platform/extensions/common/extensionValidator.js
function $UA(version) {
  version = version.trim();
  return version === "*" || VERSION_REGEXP.test(version);
}
function $VA(version) {
  if (!$UA(version)) {
    return null;
  }
  version = version.trim();
  if (version === "*") {
    return {
      hasCaret: false,
      hasGreaterEquals: false,
      majorBase: 0,
      majorMustEqual: false,
      minorBase: 0,
      minorMustEqual: false,
      patchBase: 0,
      patchMustEqual: false,
      preRelease: null
    };
  }
  const m = version.match(VERSION_REGEXP);
  if (!m) {
    return null;
  }
  return {
    hasCaret: m[1] === "^",
    hasGreaterEquals: m[1] === ">=",
    majorBase: m[2] === "x" ? 0 : parseInt(m[2], 10),
    majorMustEqual: m[2] === "x" ? false : true,
    minorBase: m[4] === "x" ? 0 : parseInt(m[4], 10),
    minorMustEqual: m[4] === "x" ? false : true,
    patchBase: m[6] === "x" ? 0 : parseInt(m[6], 10),
    patchMustEqual: m[6] === "x" ? false : true,
    preRelease: m[8] || null
  };
}
function $WA(version) {
  if (!version) {
    return null;
  }
  const majorBase = version.majorBase;
  const majorMustEqual = version.majorMustEqual;
  const minorBase = version.minorBase;
  let minorMustEqual = version.minorMustEqual;
  const patchBase = version.patchBase;
  let patchMustEqual = version.patchMustEqual;
  if (version.hasCaret) {
    if (majorBase === 0) {
      patchMustEqual = false;
    } else {
      minorMustEqual = false;
      patchMustEqual = false;
    }
  }
  let notBefore = 0;
  if (version.preRelease) {
    const match = NOT_BEFORE_REGEXP.exec(version.preRelease);
    if (match) {
      const [, year2, month2, day2] = match;
      notBefore = Date.UTC(Number(year2), Number(month2) - 1, Number(day2));
    }
  }
  return {
    majorBase,
    majorMustEqual,
    minorBase,
    minorMustEqual,
    patchBase,
    patchMustEqual,
    isMinimum: version.hasGreaterEquals,
    notBefore
  };
}
function $XA(_inputVersion, _inputDate, _desiredVersion) {
  let version;
  if (typeof _inputVersion === "string") {
    version = $WA($VA(_inputVersion));
  } else {
    version = _inputVersion;
  }
  let productTs;
  if (_inputDate instanceof Date) {
    productTs = _inputDate.getTime();
  } else if (typeof _inputDate === "string") {
    productTs = new Date(_inputDate).getTime();
  }
  let desiredVersion;
  if (typeof _desiredVersion === "string") {
    desiredVersion = $WA($VA(_desiredVersion));
  } else {
    desiredVersion = _desiredVersion;
  }
  if (!version || !desiredVersion) {
    return false;
  }
  const majorBase = version.majorBase;
  const minorBase = version.minorBase;
  const patchBase = version.patchBase;
  let desiredMajorBase = desiredVersion.majorBase;
  let desiredMinorBase = desiredVersion.minorBase;
  let desiredPatchBase = desiredVersion.patchBase;
  const desiredNotBefore = desiredVersion.notBefore;
  let majorMustEqual = desiredVersion.majorMustEqual;
  let minorMustEqual = desiredVersion.minorMustEqual;
  let patchMustEqual = desiredVersion.patchMustEqual;
  if (desiredVersion.isMinimum) {
    if (majorBase > desiredMajorBase) {
      return true;
    }
    if (majorBase < desiredMajorBase) {
      return false;
    }
    if (minorBase > desiredMinorBase) {
      return true;
    }
    if (minorBase < desiredMinorBase) {
      return false;
    }
    if (productTs && productTs < desiredNotBefore) {
      return false;
    }
    return patchBase >= desiredPatchBase;
  }
  if (majorBase === 1 && desiredMajorBase === 0 && (!majorMustEqual || !minorMustEqual || !patchMustEqual)) {
    desiredMajorBase = 1;
    desiredMinorBase = 0;
    desiredPatchBase = 0;
    majorMustEqual = true;
    minorMustEqual = false;
    patchMustEqual = false;
  }
  if (majorBase < desiredMajorBase) {
    return false;
  }
  if (majorBase > desiredMajorBase) {
    return !majorMustEqual;
  }
  if (minorBase < desiredMinorBase) {
    return false;
  }
  if (minorBase > desiredMinorBase) {
    return !minorMustEqual;
  }
  if (patchBase < desiredPatchBase) {
    return false;
  }
  if (patchBase > desiredPatchBase) {
    return !patchMustEqual;
  }
  if (productTs && productTs < desiredNotBefore) {
    return false;
  }
  return true;
}
function $YA(productVersion, productDate, extensionLocation, extensionManifest, extensionIsBuiltin, validateApiVersion) {
  const validations = [];
  if (typeof extensionManifest.publisher !== "undefined" && typeof extensionManifest.publisher !== "string") {
    validations.push([severity_default.Error, localize(1876, null)]);
    return validations;
  }
  if (typeof extensionManifest.name !== "string") {
    validations.push([severity_default.Error, localize(1877, null, "name")]);
    return validations;
  }
  if (typeof extensionManifest.version !== "string") {
    validations.push([severity_default.Error, localize(1878, null, "version")]);
    return validations;
  }
  if (!extensionManifest.engines) {
    validations.push([severity_default.Error, localize(1879, null, "engines")]);
    return validations;
  }
  if (typeof extensionManifest.engines.vscode !== "string") {
    validations.push([severity_default.Error, localize(1880, null, "engines.vscode")]);
    return validations;
  }
  if (typeof extensionManifest.extensionDependencies !== "undefined") {
    if (!isStringArray(extensionManifest.extensionDependencies)) {
      validations.push([severity_default.Error, localize(1881, null, "extensionDependencies")]);
      return validations;
    }
  }
  if (typeof extensionManifest.activationEvents !== "undefined") {
    if (!isStringArray(extensionManifest.activationEvents)) {
      validations.push([severity_default.Error, localize(1882, null, "activationEvents")]);
      return validations;
    }
    if (typeof extensionManifest.main === "undefined" && typeof extensionManifest.browser === "undefined") {
      validations.push([severity_default.Error, localize(1883, null, "activationEvents", "main", "browser")]);
      return validations;
    }
  }
  if (typeof extensionManifest.extensionKind !== "undefined") {
    if (typeof extensionManifest.main === "undefined") {
      validations.push([severity_default.Warning, localize(1884, null, "extensionKind")]);
    }
  }
  if (typeof extensionManifest.main !== "undefined") {
    if (typeof extensionManifest.main !== "string") {
      validations.push([severity_default.Error, localize(1885, null, "main")]);
      return validations;
    } else {
      const mainLocation = $vh(extensionLocation, extensionManifest.main);
      if (!$ph(mainLocation, extensionLocation)) {
        validations.push([severity_default.Warning, localize(1886, null, mainLocation.path, extensionLocation.path)]);
      }
    }
  }
  if (typeof extensionManifest.browser !== "undefined") {
    if (typeof extensionManifest.browser !== "string") {
      validations.push([severity_default.Error, localize(1887, null, "browser")]);
      return validations;
    } else {
      const browserLocation = $vh(extensionLocation, extensionManifest.browser);
      if (!$ph(browserLocation, extensionLocation)) {
        validations.push([severity_default.Warning, localize(1888, null, browserLocation.path, extensionLocation.path)]);
      }
    }
  }
  if (!valid(extensionManifest.version)) {
    validations.push([severity_default.Error, localize(1889, null)]);
    return validations;
  }
  const notices = [];
  const validExtensionVersion = $ZA(productVersion, productDate, extensionManifest, extensionIsBuiltin, notices);
  if (!validExtensionVersion) {
    for (const notice of notices) {
      validations.push([severity_default.Error, notice]);
    }
  }
  if (validateApiVersion && extensionManifest.enabledApiProposals?.length) {
    const incompatibleNotices = [];
    if (!$2A([...extensionManifest.enabledApiProposals], incompatibleNotices)) {
      for (const notice of incompatibleNotices) {
        validations.push([severity_default.Error, notice]);
      }
    }
  }
  return validations;
}
function $ZA(productVersion, productDate, extensionManifest, extensionIsBuiltin, notices) {
  if (extensionIsBuiltin || typeof extensionManifest.main === "undefined" && typeof extensionManifest.browser === "undefined") {
    return true;
  }
  return isVersionValid(productVersion, productDate, extensionManifest.engines.vscode, notices);
}
function $1A(engine, version, date) {
  return engine === "*" || isVersionValid(version, date, engine);
}
function $2A(apiProposals, arg1) {
  if (apiProposals.length === 0) {
    return true;
  }
  const notices = Array.isArray(arg1) ? arg1 : void 0;
  const productApiProposals = (notices ? void 0 : arg1) ?? allApiProposals;
  const incompatibleProposals = [];
  const parsedProposals = $_z(apiProposals);
  for (const { proposalName, version } of parsedProposals) {
    if (!version) {
      continue;
    }
    const existingProposal = productApiProposals[proposalName];
    if (existingProposal?.version !== version) {
      incompatibleProposals.push(proposalName);
    }
  }
  if (incompatibleProposals.length) {
    if (notices) {
      if (incompatibleProposals.length === 1) {
        notices.push(localize(1890, null, incompatibleProposals[0]));
      } else {
        notices.push(localize(1891, null, incompatibleProposals.slice(0, incompatibleProposals.length - 1).map((p) => `'${p}'`).join(", "), incompatibleProposals[incompatibleProposals.length - 1]));
      }
    }
    return false;
  }
  return true;
}
function isVersionValid(currentVersion, date, requestedVersion, notices = []) {
  const desiredVersion = $WA($VA(requestedVersion));
  if (!desiredVersion) {
    notices.push(localize(1892, null, requestedVersion));
    return false;
  }
  if (desiredVersion.majorBase === 0) {
    if (!desiredVersion.majorMustEqual || !desiredVersion.minorMustEqual) {
      notices.push(localize(1893, null, requestedVersion));
      return false;
    }
  } else {
    if (!desiredVersion.majorMustEqual) {
      notices.push(localize(1894, null, requestedVersion));
      return false;
    }
  }
  if (!$XA(currentVersion, date, desiredVersion)) {
    notices.push(localize(1895, null, currentVersion, requestedVersion));
    return false;
  }
  return true;
}
function isStringArray(arr) {
  if (!Array.isArray(arr)) {
    return false;
  }
  for (let i = 0, len = arr.length; i < len; i++) {
    if (typeof arr[i] !== "string") {
      return false;
    }
  }
  return true;
}
var VERSION_REGEXP, NOT_BEFORE_REGEXP;
var init_extensionValidator = __esm({
  "out-build/vs/platform/extensions/common/extensionValidator.js"() {
    "use strict";
    init_resources();
    init_severity();
    init_nls2();
    init_semver();
    init_extensions();
    init_extensionsApiProposals();
    VERSION_REGEXP = /^(\^|>=)?((\d+)|x)\.((\d+)|x)\.((\d+)|x)(\-.*)?$/;
    NOT_BEFORE_REGEXP = /^-(\d{4})(\d{2})(\d{2})$/;
  }
});

// out-build/vs/base/common/ternarySearchTree.js
var $Sk, $Tk, $Uk, UriIteratorState, $Vk, TernarySearchTreeNode, Dir, $Wk;
var init_ternarySearchTree = __esm({
  "out-build/vs/base/common/ternarySearchTree.js"() {
    "use strict";
    init_arrays();
    init_strings();
    $Sk = class {
      constructor() {
        this.b = "";
        this.c = 0;
      }
      reset(key) {
        this.b = key;
        this.c = 0;
        return this;
      }
      next() {
        this.c += 1;
        return this;
      }
      hasNext() {
        return this.c < this.b.length - 1;
      }
      cmp(a) {
        const aCode = a.charCodeAt(0);
        const thisCode = this.b.charCodeAt(this.c);
        return aCode - thisCode;
      }
      value() {
        return this.b[this.c];
      }
    };
    $Tk = class {
      constructor(e = true) {
        this.e = e;
      }
      reset(key) {
        this.b = key;
        this.c = 0;
        this.d = 0;
        return this.next();
      }
      hasNext() {
        return this.d < this.b.length;
      }
      next() {
        this.c = this.d;
        let justSeps = true;
        for (; this.d < this.b.length; this.d++) {
          const ch = this.b.charCodeAt(this.d);
          if (ch === 46) {
            if (justSeps) {
              this.c++;
            } else {
              break;
            }
          } else {
            justSeps = false;
          }
        }
        return this;
      }
      cmp(a) {
        return this.e ? $Uf(a, this.b, 0, a.length, this.c, this.d) : $Wf(a, this.b, 0, a.length, this.c, this.d);
      }
      value() {
        return this.b.substring(this.c, this.d);
      }
    };
    $Uk = class {
      constructor(f = true, g = true) {
        this.f = f;
        this.g = g;
      }
      reset(key) {
        this.d = 0;
        this.e = 0;
        this.b = key;
        this.c = key.length;
        for (let pos = key.length - 1; pos >= 0; pos--, this.c--) {
          const ch = this.b.charCodeAt(pos);
          if (!(ch === 47 || this.f && ch === 92)) {
            break;
          }
        }
        return this.next();
      }
      hasNext() {
        return this.e < this.c;
      }
      next() {
        this.d = this.e;
        let justSeps = true;
        for (; this.e < this.c; this.e++) {
          const ch = this.b.charCodeAt(this.e);
          if (ch === 47 || this.f && ch === 92) {
            if (justSeps) {
              this.d++;
            } else {
              break;
            }
          } else {
            justSeps = false;
          }
        }
        return this;
      }
      cmp(a) {
        return this.g ? $Uf(a, this.b, 0, a.length, this.d, this.e) : $Wf(a, this.b, 0, a.length, this.d, this.e);
      }
      value() {
        return this.b.substring(this.d, this.e);
      }
    };
    (function(UriIteratorState2) {
      UriIteratorState2[UriIteratorState2["Scheme"] = 1] = "Scheme";
      UriIteratorState2[UriIteratorState2["Authority"] = 2] = "Authority";
      UriIteratorState2[UriIteratorState2["Path"] = 3] = "Path";
      UriIteratorState2[UriIteratorState2["Query"] = 4] = "Query";
      UriIteratorState2[UriIteratorState2["Fragment"] = 5] = "Fragment";
    })(UriIteratorState || (UriIteratorState = {}));
    $Vk = class {
      constructor(f, g) {
        this.f = f;
        this.g = g;
        this.d = [];
        this.e = 0;
      }
      reset(key) {
        this.c = key;
        this.d = [];
        if (this.c.scheme) {
          this.d.push(
            1
            /* UriIteratorState.Scheme */
          );
        }
        if (this.c.authority) {
          this.d.push(
            2
            /* UriIteratorState.Authority */
          );
        }
        if (this.c.path) {
          this.b = new $Uk(false, !this.f(key));
          this.b.reset(key.path);
          if (this.b.value()) {
            this.d.push(
              3
              /* UriIteratorState.Path */
            );
          }
        }
        if (!this.g(key)) {
          if (this.c.query) {
            this.d.push(
              4
              /* UriIteratorState.Query */
            );
          }
          if (this.c.fragment) {
            this.d.push(
              5
              /* UriIteratorState.Fragment */
            );
          }
        }
        this.e = 0;
        return this;
      }
      next() {
        if (this.d[this.e] === 3 && this.b.hasNext()) {
          this.b.next();
        } else {
          this.e += 1;
        }
        return this;
      }
      hasNext() {
        return this.d[this.e] === 3 && this.b.hasNext() || this.e < this.d.length - 1;
      }
      cmp(a) {
        if (this.d[this.e] === 1) {
          return $Vf(a, this.c.scheme);
        } else if (this.d[this.e] === 2) {
          return $Vf(a, this.c.authority);
        } else if (this.d[this.e] === 3) {
          return this.b.cmp(a);
        } else if (this.d[this.e] === 4) {
          return $Tf(a, this.c.query);
        } else if (this.d[this.e] === 5) {
          return $Tf(a, this.c.fragment);
        }
        throw new Error();
      }
      value() {
        if (this.d[this.e] === 1) {
          return this.c.scheme;
        } else if (this.d[this.e] === 2) {
          return this.c.authority;
        } else if (this.d[this.e] === 3) {
          return this.b.value();
        } else if (this.d[this.e] === 4) {
          return this.c.query;
        } else if (this.d[this.e] === 5) {
          return this.c.fragment;
        }
        throw new Error();
      }
    };
    TernarySearchTreeNode = class {
      constructor() {
        this.height = 1;
      }
      isEmpty() {
        return !this.left && !this.mid && !this.right && !this.value;
      }
      rotateLeft() {
        const tmp = this.right;
        this.right = tmp.left;
        tmp.left = this;
        this.updateHeight();
        tmp.updateHeight();
        return tmp;
      }
      rotateRight() {
        const tmp = this.left;
        this.left = tmp.right;
        tmp.right = this;
        this.updateHeight();
        tmp.updateHeight();
        return tmp;
      }
      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;
      }
    };
    (function(Dir2) {
      Dir2[Dir2["Left"] = -1] = "Left";
      Dir2[Dir2["Mid"] = 0] = "Mid";
      Dir2[Dir2["Right"] = 1] = "Right";
    })(Dir || (Dir = {}));
    $Wk = class _$Wk {
      static forUris(ignorePathCasing = () => false, ignoreQueryAndFragment = () => false) {
        return new _$Wk(new $Vk(ignorePathCasing, ignoreQueryAndFragment));
      }
      static forPaths(ignorePathCasing = false) {
        return new _$Wk(new $Uk(void 0, !ignorePathCasing));
      }
      static forStrings() {
        return new _$Wk(new $Sk());
      }
      static forConfigKeys() {
        return new _$Wk(new $Tk());
      }
      constructor(segments) {
        this.b = segments;
      }
      clear() {
        this.c = void 0;
      }
      fill(values, keys) {
        if (keys) {
          const arr = keys.slice(0);
          $Zb(arr);
          for (const k of arr) {
            this.set(k, values);
          }
        } else {
          const arr = values.slice(0);
          $Zb(arr);
          for (const entry of arr) {
            this.set(entry[0], entry[1]);
          }
        }
      }
      set(key, element) {
        const iter = this.b.reset(key);
        let node;
        if (!this.c) {
          this.c = new TernarySearchTreeNode();
          this.c.segment = iter.value();
        }
        const stack = [];
        node = this.c;
        while (true) {
          const val = iter.cmp(node.segment);
          if (val > 0) {
            if (!node.left) {
              node.left = new TernarySearchTreeNode();
              node.left.segment = iter.value();
            }
            stack.push([-1, node]);
            node = node.left;
          } else if (val < 0) {
            if (!node.right) {
              node.right = new TernarySearchTreeNode();
              node.right.segment = iter.value();
            }
            stack.push([1, node]);
            node = node.right;
          } else if (iter.hasNext()) {
            iter.next();
            if (!node.mid) {
              node.mid = new TernarySearchTreeNode();
              node.mid.segment = iter.value();
            }
            stack.push([0, node]);
            node = node.mid;
          } else {
            break;
          }
        }
        const oldElement = node.value;
        node.value = element;
        node.key = key;
        for (let i = stack.length - 1; i >= 0; i--) {
          const node2 = stack[i][1];
          node2.updateHeight();
          const bf = node2.balanceFactor();
          if (bf < -1 || bf > 1) {
            const d1 = stack[i][0];
            const d2 = stack[i + 1][0];
            if (d1 === 1 && d2 === 1) {
              stack[i][1] = node2.rotateLeft();
            } else if (d1 === -1 && d2 === -1) {
              stack[i][1] = node2.rotateRight();
            } else if (d1 === 1 && d2 === -1) {
              node2.right = stack[i + 1][1] = stack[i + 1][1].rotateRight();
              stack[i][1] = node2.rotateLeft();
            } else if (d1 === -1 && d2 === 1) {
              node2.left = stack[i + 1][1] = stack[i + 1][1].rotateLeft();
              stack[i][1] = node2.rotateRight();
            } else {
              throw new Error();
            }
            if (i > 0) {
              switch (stack[i - 1][0]) {
                case -1:
                  stack[i - 1][1].left = stack[i][1];
                  break;
                case 1:
                  stack[i - 1][1].right = stack[i][1];
                  break;
                case 0:
                  stack[i - 1][1].mid = stack[i][1];
                  break;
              }
            } else {
              this.c = stack[0][1];
            }
          }
        }
        return oldElement;
      }
      get(key) {
        return this.d(key)?.value;
      }
      d(key) {
        const iter = this.b.reset(key);
        let node = this.c;
        while (node) {
          const val = iter.cmp(node.segment);
          if (val > 0) {
            node = node.left;
          } else if (val < 0) {
            node = node.right;
          } else if (iter.hasNext()) {
            iter.next();
            node = node.mid;
          } else {
            break;
          }
        }
        return node;
      }
      has(key) {
        const node = this.d(key);
        return !(node?.value === void 0 && node?.mid === void 0);
      }
      delete(key) {
        return this.e(key, false);
      }
      deleteSuperstr(key) {
        return this.e(key, true);
      }
      e(key, superStr) {
        const iter = this.b.reset(key);
        const stack = [];
        let node = this.c;
        while (node) {
          const val = iter.cmp(node.segment);
          if (val > 0) {
            stack.push([-1, node]);
            node = node.left;
          } else if (val < 0) {
            stack.push([1, node]);
            node = node.right;
          } else if (iter.hasNext()) {
            iter.next();
            stack.push([0, node]);
            node = node.mid;
          } else {
            break;
          }
        }
        if (!node) {
          return;
        }
        if (superStr) {
          node.left = void 0;
          node.mid = void 0;
          node.right = void 0;
          node.height = 1;
        } else {
          node.key = void 0;
          node.value = void 0;
        }
        if (!node.mid && !node.value) {
          if (node.left && node.right) {
            const min = this.f(node.right);
            if (min.key) {
              const { key: key2, value, segment } = min;
              this.e(min.key, false);
              node.key = key2;
              node.value = value;
              node.segment = segment;
            }
          } else {
            const newChild = node.left ?? node.right;
            if (stack.length > 0) {
              const [dir, parent] = stack[stack.length - 1];
              switch (dir) {
                case -1:
                  parent.left = newChild;
                  break;
                case 0:
                  parent.mid = newChild;
                  break;
                case 1:
                  parent.right = newChild;
                  break;
              }
            } else {
              this.c = newChild;
            }
          }
        }
        for (let i = stack.length - 1; i >= 0; i--) {
          const node2 = stack[i][1];
          node2.updateHeight();
          const bf = node2.balanceFactor();
          if (bf > 1) {
            if (node2.right.balanceFactor() >= 0) {
              stack[i][1] = node2.rotateLeft();
            } else {
              node2.right = node2.right.rotateRight();
              stack[i][1] = node2.rotateLeft();
            }
          } else if (bf < -1) {
            if (node2.left.balanceFactor() <= 0) {
              stack[i][1] = node2.rotateRight();
            } else {
              node2.left = node2.left.rotateLeft();
              stack[i][1] = node2.rotateRight();
            }
          }
          if (i > 0) {
            switch (stack[i - 1][0]) {
              case -1:
                stack[i - 1][1].left = stack[i][1];
                break;
              case 1:
                stack[i - 1][1].right = stack[i][1];
                break;
              case 0:
                stack[i - 1][1].mid = stack[i][1];
                break;
            }
          } else {
            this.c = stack[0][1];
          }
        }
      }
      f(node) {
        while (node.left) {
          node = node.left;
        }
        return node;
      }
      findSubstr(key) {
        const iter = this.b.reset(key);
        let node = this.c;
        let candidate = void 0;
        while (node) {
          const val = iter.cmp(node.segment);
          if (val > 0) {
            node = node.left;
          } else if (val < 0) {
            node = node.right;
          } else if (iter.hasNext()) {
            iter.next();
            candidate = node.value || candidate;
            node = node.mid;
          } else {
            break;
          }
        }
        return node && node.value || candidate;
      }
      findSuperstr(key) {
        return this.g(key, false);
      }
      g(key, allowValue) {
        const iter = this.b.reset(key);
        let node = this.c;
        while (node) {
          const val = iter.cmp(node.segment);
          if (val > 0) {
            node = node.left;
          } else if (val < 0) {
            node = node.right;
          } else if (iter.hasNext()) {
            iter.next();
            node = node.mid;
          } else {
            if (!node.mid) {
              if (allowValue) {
                return node.value;
              } else {
                return void 0;
              }
            } else {
              return this.h(node.mid);
            }
          }
        }
        return void 0;
      }
      hasElementOrSubtree(key) {
        return this.g(key, true) !== void 0;
      }
      forEach(callback) {
        for (const [key, value] of this) {
          callback(value, key);
        }
      }
      *[Symbol.iterator]() {
        yield* this.h(this.c);
      }
      h(node) {
        const result = [];
        this.j(node, result);
        return result[Symbol.iterator]();
      }
      j(node, bucket) {
        if (!node) {
          return;
        }
        if (node.left) {
          this.j(node.left, bucket);
        }
        if (node.value) {
          bucket.push([node.key, node.value]);
        }
        if (node.mid) {
          this.j(node.mid, bucket);
        }
        if (node.right) {
          this.j(node.right, bucket);
        }
      }
      // for debug/testing
      _isBalanced() {
        const nodeIsBalanced = (node) => {
          if (!node) {
            return true;
          }
          const bf = node.balanceFactor();
          if (bf < -1 || bf > 1) {
            return false;
          }
          return nodeIsBalanced(node.left) && nodeIsBalanced(node.right);
        };
        return nodeIsBalanced(this.c);
      }
    };
  }
});

// out-build/vs/platform/files/common/files.js
function $lm(options2) {
  return options2.create === true;
}
function $nm(provider) {
  return !!(provider.capabilities & 2);
}
function $om(provider) {
  return !!(provider.capabilities & 8);
}
function $pm(provider) {
  return !!(provider.capabilities & 131072);
}
function $qm(provider) {
  return !!(provider.capabilities & 4);
}
function $rm(provider) {
  return !!(provider.capabilities & 16);
}
function $sm(provider) {
  if (!$nm(provider)) {
    return false;
  }
  return !!(provider.capabilities & 16384);
}
function $tm(provider) {
  if (!$nm(provider)) {
    return false;
  }
  return !!(provider.capabilities & 32768);
}
function $um(provider) {
  return !!(provider.capabilities & 65536);
}
function $xm(error, code) {
  return $wm.create(error, code);
}
function $ym(error) {
  if (!error) {
    return $xm(localize(1910, null), FileSystemProviderErrorCode.Unknown);
  }
  return error;
}
function $zm(error, code) {
  error.name = code ? `${code} (FileSystemError)` : `FileSystemError`;
  return error;
}
function $Am(error) {
  if (!error) {
    return FileSystemProviderErrorCode.Unknown;
  }
  if (error instanceof $wm) {
    return error.code;
  }
  const match = /^(.+) \(FileSystemError\)$/.exec(error.name);
  if (!match) {
    return FileSystemProviderErrorCode.Unknown;
  }
  switch (match[1]) {
    case FileSystemProviderErrorCode.FileExists:
      return FileSystemProviderErrorCode.FileExists;
    case FileSystemProviderErrorCode.FileIsADirectory:
      return FileSystemProviderErrorCode.FileIsADirectory;
    case FileSystemProviderErrorCode.FileNotADirectory:
      return FileSystemProviderErrorCode.FileNotADirectory;
    case FileSystemProviderErrorCode.FileNotFound:
      return FileSystemProviderErrorCode.FileNotFound;
    case FileSystemProviderErrorCode.FileTooLarge:
      return FileSystemProviderErrorCode.FileTooLarge;
    case FileSystemProviderErrorCode.FileWriteLocked:
      return FileSystemProviderErrorCode.FileWriteLocked;
    case FileSystemProviderErrorCode.NoPermissions:
      return FileSystemProviderErrorCode.NoPermissions;
    case FileSystemProviderErrorCode.Unavailable:
      return FileSystemProviderErrorCode.Unavailable;
  }
  return FileSystemProviderErrorCode.Unknown;
}
function $Bm(error) {
  if (error instanceof $Fm) {
    return error.fileOperationResult;
  }
  switch ($Am(error)) {
    case FileSystemProviderErrorCode.FileNotFound:
      return 1;
    case FileSystemProviderErrorCode.FileIsADirectory:
      return 0;
    case FileSystemProviderErrorCode.FileNotADirectory:
      return 9;
    case FileSystemProviderErrorCode.FileWriteLocked:
      return 5;
    case FileSystemProviderErrorCode.NoPermissions:
      return 6;
    case FileSystemProviderErrorCode.FileExists:
      return 4;
    case FileSystemProviderErrorCode.FileTooLarge:
      return 7;
    default:
      return 10;
  }
}
function $Em(path7, candidate, ignoreCase) {
  if (!path7 || !candidate || path7 === candidate) {
    return false;
  }
  if (candidate.length > path7.length) {
    return false;
  }
  if (candidate.charAt(candidate.length - 1) !== sep) {
    candidate += sep;
  }
  if (ignoreCase) {
    return $2f(path7, candidate);
  }
  return path7.indexOf(candidate) === 0;
}
function $Qm(stat) {
  if (typeof stat.size !== "number" || typeof stat.mtime !== "number") {
    return void 0;
  }
  return stat.mtime.toString(29) + stat.size.toString(31);
}
var $km, FileType, FilePermission, FileChangeFilter, FileSystemProviderCapabilities, FileSystemProviderErrorCode, $wm, FileOperation, $Cm, FileChangeType, $Dm, $Fm, $Gm, $Hm, FileOperationResult, FileKind, $Pm, $Sm;
var init_files = __esm({
  "out-build/vs/platform/files/common/files.js"() {
    "use strict";
    init_ternarySearchTree();
    init_path();
    init_strings();
    init_types();
    init_uri();
    init_nls2();
    init_instantiation();
    init_platform();
    init_network();
    init_lazy();
    $km = $Qk("fileService");
    (function(FileType2) {
      FileType2[FileType2["Unknown"] = 0] = "Unknown";
      FileType2[FileType2["File"] = 1] = "File";
      FileType2[FileType2["Directory"] = 2] = "Directory";
      FileType2[FileType2["SymbolicLink"] = 64] = "SymbolicLink";
    })(FileType || (FileType = {}));
    (function(FilePermission2) {
      FilePermission2[FilePermission2["Readonly"] = 1] = "Readonly";
      FilePermission2[FilePermission2["Locked"] = 2] = "Locked";
    })(FilePermission || (FilePermission = {}));
    (function(FileChangeFilter2) {
      FileChangeFilter2[FileChangeFilter2["UPDATED"] = 2] = "UPDATED";
      FileChangeFilter2[FileChangeFilter2["ADDED"] = 4] = "ADDED";
      FileChangeFilter2[FileChangeFilter2["DELETED"] = 8] = "DELETED";
    })(FileChangeFilter || (FileChangeFilter = {}));
    (function(FileSystemProviderCapabilities2) {
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["None"] = 0] = "None";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["FileReadWrite"] = 2] = "FileReadWrite";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["FileOpenReadWriteClose"] = 4] = "FileOpenReadWriteClose";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["FileReadStream"] = 16] = "FileReadStream";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["FileFolderCopy"] = 8] = "FileFolderCopy";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["PathCaseSensitive"] = 1024] = "PathCaseSensitive";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["Readonly"] = 2048] = "Readonly";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["Trash"] = 4096] = "Trash";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["FileWriteUnlock"] = 8192] = "FileWriteUnlock";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["FileAtomicRead"] = 16384] = "FileAtomicRead";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["FileAtomicWrite"] = 32768] = "FileAtomicWrite";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["FileAtomicDelete"] = 65536] = "FileAtomicDelete";
      FileSystemProviderCapabilities2[FileSystemProviderCapabilities2["FileClone"] = 131072] = "FileClone";
    })(FileSystemProviderCapabilities || (FileSystemProviderCapabilities = {}));
    (function(FileSystemProviderErrorCode2) {
      FileSystemProviderErrorCode2["FileExists"] = "EntryExists";
      FileSystemProviderErrorCode2["FileNotFound"] = "EntryNotFound";
      FileSystemProviderErrorCode2["FileNotADirectory"] = "EntryNotADirectory";
      FileSystemProviderErrorCode2["FileIsADirectory"] = "EntryIsADirectory";
      FileSystemProviderErrorCode2["FileExceedsStorageQuota"] = "EntryExceedsStorageQuota";
      FileSystemProviderErrorCode2["FileTooLarge"] = "EntryTooLarge";
      FileSystemProviderErrorCode2["FileWriteLocked"] = "EntryWriteLocked";
      FileSystemProviderErrorCode2["NoPermissions"] = "NoPermissions";
      FileSystemProviderErrorCode2["Unavailable"] = "Unavailable";
      FileSystemProviderErrorCode2["Unknown"] = "Unknown";
    })(FileSystemProviderErrorCode || (FileSystemProviderErrorCode = {}));
    $wm = class _$wm extends Error {
      static create(error, code) {
        const providerError = new _$wm(error.toString(), code);
        $zm(providerError, code);
        return providerError;
      }
      constructor(message, code) {
        super(message);
        this.code = code;
      }
    };
    (function(FileOperation2) {
      FileOperation2[FileOperation2["CREATE"] = 0] = "CREATE";
      FileOperation2[FileOperation2["DELETE"] = 1] = "DELETE";
      FileOperation2[FileOperation2["MOVE"] = 2] = "MOVE";
      FileOperation2[FileOperation2["COPY"] = 3] = "COPY";
      FileOperation2[FileOperation2["WRITE"] = 4] = "WRITE";
    })(FileOperation || (FileOperation = {}));
    $Cm = class {
      constructor(resource, operation, target) {
        this.resource = resource;
        this.operation = operation;
        this.target = target;
      }
      isOperation(operation) {
        return this.operation === operation;
      }
    };
    (function(FileChangeType3) {
      FileChangeType3[FileChangeType3["UPDATED"] = 0] = "UPDATED";
      FileChangeType3[FileChangeType3["ADDED"] = 1] = "ADDED";
      FileChangeType3[FileChangeType3["DELETED"] = 2] = "DELETED";
    })(FileChangeType || (FileChangeType = {}));
    $Dm = class _$Dm {
      static {
        this.a = null;
      }
      constructor(changes, c) {
        this.c = c;
        this.b = void 0;
        this.d = new $sf(() => {
          const added = $Wk.forUris(() => this.c);
          added.fill(this.rawAdded.map((resource) => [resource, true]));
          return added;
        });
        this.f = new $sf(() => {
          const updated = $Wk.forUris(() => this.c);
          updated.fill(this.rawUpdated.map((resource) => [resource, true]));
          return updated;
        });
        this.g = new $sf(() => {
          const deleted = $Wk.forUris(() => this.c);
          deleted.fill(this.rawDeleted.map((resource) => [resource, true]));
          return deleted;
        });
        this.rawAdded = [];
        this.rawUpdated = [];
        this.rawDeleted = [];
        for (const change of changes) {
          switch (change.type) {
            case 1:
              this.rawAdded.push(change.resource);
              break;
            case 0:
              this.rawUpdated.push(change.resource);
              break;
            case 2:
              this.rawDeleted.push(change.resource);
              break;
          }
          if (this.b !== _$Dm.a) {
            if (typeof change.cId === "number") {
              if (this.b === void 0) {
                this.b = change.cId;
              } else if (this.b !== change.cId) {
                this.b = _$Dm.a;
              }
            } else {
              if (this.b !== void 0) {
                this.b = _$Dm.a;
              }
            }
          }
        }
      }
      /**
       * Find out if the file change events match the provided resource.
       *
       * Note: when passing `FileChangeType.DELETED`, we consider a match
       * also when the parent of the resource got deleted.
       */
      contains(resource, ...types) {
        return this.h(resource, { includeChildren: false }, ...types);
      }
      /**
       * Find out if the file change events either match the provided
       * resource, or contain a child of this resource.
       */
      affects(resource, ...types) {
        return this.h(resource, { includeChildren: true }, ...types);
      }
      h(resource, options2, ...types) {
        if (!resource) {
          return false;
        }
        const hasTypesFilter = types.length > 0;
        if (!hasTypesFilter || types.includes(
          1
          /* FileChangeType.ADDED */
        )) {
          if (this.d.value.get(resource)) {
            return true;
          }
          if (options2.includeChildren && this.d.value.findSuperstr(resource)) {
            return true;
          }
        }
        if (!hasTypesFilter || types.includes(
          0
          /* FileChangeType.UPDATED */
        )) {
          if (this.f.value.get(resource)) {
            return true;
          }
          if (options2.includeChildren && this.f.value.findSuperstr(resource)) {
            return true;
          }
        }
        if (!hasTypesFilter || types.includes(
          2
          /* FileChangeType.DELETED */
        )) {
          if (this.g.value.findSubstr(resource)) {
            return true;
          }
          if (options2.includeChildren && this.g.value.findSuperstr(resource)) {
            return true;
          }
        }
        return false;
      }
      /**
       * Returns if this event contains added files.
       */
      gotAdded() {
        return this.rawAdded.length > 0;
      }
      /**
       * Returns if this event contains deleted files.
       */
      gotDeleted() {
        return this.rawDeleted.length > 0;
      }
      /**
       * Returns if this event contains updated files.
       */
      gotUpdated() {
        return this.rawUpdated.length > 0;
      }
      /**
       * Returns if this event contains changes that correlate to the
       * provided `correlationId`.
       *
       * File change event correlation is an advanced watch feature that
       * allows to  identify from which watch request the events originate
       * from. This correlation allows to route events specifically
       * only to the requestor and not emit them to all listeners.
       */
      correlates(correlationId) {
        return this.b === correlationId;
      }
      /**
       * Figure out if the event contains changes that correlate to one
       * correlation identifier.
       *
       * File change event correlation is an advanced watch feature that
       * allows to  identify from which watch request the events originate
       * from. This correlation allows to route events specifically
       * only to the requestor and not emit them to all listeners.
       */
      hasCorrelation() {
        return typeof this.b === "number";
      }
    };
    $Fm = class extends Error {
      constructor(message, fileOperationResult, options2) {
        super(message);
        this.fileOperationResult = fileOperationResult;
        this.options = options2;
      }
    };
    $Gm = class extends $Fm {
      constructor(message, fileOperationResult, size, options2) {
        super(message, fileOperationResult, options2);
        this.fileOperationResult = fileOperationResult;
        this.size = size;
      }
    };
    $Hm = class extends $Fm {
      constructor(message, stat, options2) {
        super(message, 2, options2);
        this.stat = stat;
      }
    };
    (function(FileOperationResult2) {
      FileOperationResult2[FileOperationResult2["FILE_IS_DIRECTORY"] = 0] = "FILE_IS_DIRECTORY";
      FileOperationResult2[FileOperationResult2["FILE_NOT_FOUND"] = 1] = "FILE_NOT_FOUND";
      FileOperationResult2[FileOperationResult2["FILE_NOT_MODIFIED_SINCE"] = 2] = "FILE_NOT_MODIFIED_SINCE";
      FileOperationResult2[FileOperationResult2["FILE_MODIFIED_SINCE"] = 3] = "FILE_MODIFIED_SINCE";
      FileOperationResult2[FileOperationResult2["FILE_MOVE_CONFLICT"] = 4] = "FILE_MOVE_CONFLICT";
      FileOperationResult2[FileOperationResult2["FILE_WRITE_LOCKED"] = 5] = "FILE_WRITE_LOCKED";
      FileOperationResult2[FileOperationResult2["FILE_PERMISSION_DENIED"] = 6] = "FILE_PERMISSION_DENIED";
      FileOperationResult2[FileOperationResult2["FILE_TOO_LARGE"] = 7] = "FILE_TOO_LARGE";
      FileOperationResult2[FileOperationResult2["FILE_INVALID_PATH"] = 8] = "FILE_INVALID_PATH";
      FileOperationResult2[FileOperationResult2["FILE_NOT_DIRECTORY"] = 9] = "FILE_NOT_DIRECTORY";
      FileOperationResult2[FileOperationResult2["FILE_OTHER_ERROR"] = 10] = "FILE_OTHER_ERROR";
    })(FileOperationResult || (FileOperationResult = {}));
    (function(FileKind2) {
      FileKind2[FileKind2["FILE"] = 0] = "FILE";
      FileKind2[FileKind2["FOLDER"] = 1] = "FOLDER";
      FileKind2[FileKind2["ROOT_FOLDER"] = 2] = "ROOT_FOLDER";
    })(FileKind || (FileKind = {}));
    $Pm = "";
    $Sm = class _$Sm {
      static {
        this.KB = 1024;
      }
      static {
        this.MB = _$Sm.KB * _$Sm.KB;
      }
      static {
        this.GB = _$Sm.MB * _$Sm.KB;
      }
      static {
        this.TB = _$Sm.GB * _$Sm.KB;
      }
      static formatSize(size) {
        if (!$Dg(size)) {
          size = 0;
        }
        if (size < _$Sm.KB) {
          return localize(1911, null, size.toFixed(0));
        }
        if (size < _$Sm.MB) {
          return localize(1912, null, (size / _$Sm.KB).toFixed(2));
        }
        if (size < _$Sm.GB) {
          return localize(1913, null, (size / _$Sm.MB).toFixed(2));
        }
        if (size < _$Sm.TB) {
          return localize(1914, null, (size / _$Sm.GB).toFixed(2));
        }
        return localize(1915, null, (size / _$Sm.TB).toFixed(2));
      }
    };
  }
});

// out-build/vs/platform/product/common/productService.js
var $Vu;
var init_productService = __esm({
  "out-build/vs/platform/product/common/productService.js"() {
    "use strict";
    init_instantiation();
    $Vu = $Qk("productService");
  }
});

// out-build/vs/platform/externalServices/common/serviceMachineId.js
async function $7v(environmentService, fileService, storageService) {
  let uuid = storageService ? storageService.get(
    "storage.serviceMachineId",
    -1
    /* StorageScope.APPLICATION */
  ) || null : null;
  if (uuid) {
    return uuid;
  }
  try {
    const contents = await fileService.readFile(environmentService.serviceMachineIdResource);
    const value = contents.value.toString();
    uuid = $os(value) ? value : null;
  } catch (e) {
    uuid = null;
  }
  if (!uuid) {
    uuid = $ps();
    try {
      await fileService.writeFile(environmentService.serviceMachineIdResource, $Ci.fromString(uuid));
    } catch (error) {
    }
  }
  storageService?.store(
    "storage.serviceMachineId",
    uuid,
    -1,
    1
    /* StorageTarget.MACHINE */
  );
  return uuid;
}
var init_serviceMachineId = __esm({
  "out-build/vs/platform/externalServices/common/serviceMachineId.js"() {
    "use strict";
    init_buffer();
    init_uuid();
  }
});

// out-build/vs/platform/externalServices/common/marketplace.js
async function $qw(version, productService, environmentService, configurationService, fileService, storageService, telemetryService) {
  const headers = {
    "X-Market-Client-Id": `VSCode ${version}`,
    "User-Agent": `VSCode ${version} (${productService.nameShort})`
  };
  if ($iw(productService, environmentService) && $kw(configurationService) === 3) {
    const serviceMachineId = await $7v(environmentService, fileService, storageService);
    headers["X-Market-User-Id"] = serviceMachineId;
    headers["VSCode-SessionId"] = telemetryService.machineId || serviceMachineId;
  }
  return headers;
}
var init_marketplace = __esm({
  "out-build/vs/platform/externalServices/common/marketplace.js"() {
    "use strict";
    init_serviceMachineId();
    init_telemetryUtils();
  }
});

// out-build/vs/base/common/marshalling.js
function $au(obj) {
  return JSON.stringify(obj, replacer);
}
function $bu(text) {
  let data = JSON.parse(text);
  data = $cu(data);
  return data;
}
function replacer(key, value) {
  if (value instanceof RegExp) {
    return {
      $mid: 2,
      source: value.source,
      flags: value.flags
    };
  }
  return value;
}
function $cu(obj, depth = 0) {
  if (!obj || depth > 200) {
    return obj;
  }
  if (typeof obj === "object") {
    switch (obj.$mid) {
      case 1:
        return URI.revive(obj);
      case 2:
        return new RegExp(obj.source, obj.flags);
      case 17:
        return new Date(obj.source);
    }
    if (obj instanceof $Ci || obj instanceof Uint8Array) {
      return obj;
    }
    if (Array.isArray(obj)) {
      for (let i = 0; i < obj.length; ++i) {
        obj[i] = $cu(obj[i], depth + 1);
      }
    } else {
      for (const key in obj) {
        if (Object.hasOwnProperty.call(obj, key)) {
          obj[key] = $cu(obj[key], depth + 1);
        }
      }
    }
  }
  return obj;
}
var init_marshalling = __esm({
  "out-build/vs/base/common/marshalling.js"() {
    "use strict";
    init_buffer();
    init_uri();
  }
});

// out-build/vs/base/parts/storage/common/storage.js
var StorageHint, StorageState, $fv;
var init_storage = __esm({
  "out-build/vs/base/parts/storage/common/storage.js"() {
    "use strict";
    init_async();
    init_event();
    init_lifecycle();
    init_marshalling();
    init_types();
    (function(StorageHint2) {
      StorageHint2[StorageHint2["STORAGE_DOES_NOT_EXIST"] = 0] = "STORAGE_DOES_NOT_EXIST";
      StorageHint2[StorageHint2["STORAGE_IN_MEMORY"] = 1] = "STORAGE_IN_MEMORY";
    })(StorageHint || (StorageHint = {}));
    (function(StorageState2) {
      StorageState2[StorageState2["None"] = 0] = "None";
      StorageState2[StorageState2["Initialized"] = 1] = "Initialized";
      StorageState2[StorageState2["Closed"] = 2] = "Closed";
    })(StorageState || (StorageState = {}));
    $fv = class _$fv extends $3c {
      static {
        this.a = 100;
      }
      constructor(r, s = /* @__PURE__ */ Object.create(null)) {
        super();
        this.r = r;
        this.s = s;
        this.b = this.B(new $Ce());
        this.onDidChangeStorage = this.b.event;
        this.c = StorageState.None;
        this.f = /* @__PURE__ */ new Map();
        this.g = this.B(new $Th(_$fv.a));
        this.h = /* @__PURE__ */ new Set();
        this.j = /* @__PURE__ */ new Map();
        this.m = void 0;
        this.n = [];
        this.t();
      }
      t() {
        this.B(this.r.onDidChangeItemsExternal((e) => this.u(e)));
      }
      u(e) {
        this.b.pause();
        try {
          e.changed?.forEach((value, key) => this.w(key, value));
          e.deleted?.forEach((key) => this.w(key, void 0));
        } finally {
          this.b.resume();
        }
      }
      w(key, value) {
        if (this.c === StorageState.Closed) {
          return;
        }
        let changed = false;
        if ($Ig(value)) {
          changed = this.f.delete(key);
        } else {
          const currentValue = this.f.get(key);
          if (currentValue !== value) {
            this.f.set(key, value);
            changed = true;
          }
        }
        if (changed) {
          this.b.fire({ key, external: true });
        }
      }
      get items() {
        return this.f;
      }
      get size() {
        return this.f.size;
      }
      async init() {
        if (this.c !== StorageState.None) {
          return;
        }
        this.c = StorageState.Initialized;
        if (this.s.hint === StorageHint.STORAGE_DOES_NOT_EXIST) {
          return;
        }
        this.f = await this.r.getItems();
      }
      get(key, fallbackValue) {
        const value = this.f.get(key);
        if ($Ig(value)) {
          return fallbackValue;
        }
        return value;
      }
      getBoolean(key, fallbackValue) {
        const value = this.get(key);
        if ($Ig(value)) {
          return fallbackValue;
        }
        return value === "true";
      }
      getNumber(key, fallbackValue) {
        const value = this.get(key);
        if ($Ig(value)) {
          return fallbackValue;
        }
        return parseInt(value, 10);
      }
      getObject(key, fallbackValue) {
        const value = this.get(key);
        if ($Ig(value)) {
          return fallbackValue;
        }
        return $bu(value);
      }
      async set(key, value, external = false) {
        if (this.c === StorageState.Closed) {
          return;
        }
        if ($Ig(value)) {
          return this.delete(key, external);
        }
        const valueStr = $Bg(value) || Array.isArray(value) ? $au(value) : String(value);
        const currentValue = this.f.get(key);
        if (currentValue === valueStr) {
          return;
        }
        this.f.set(key, valueStr);
        this.j.set(key, valueStr);
        this.h.delete(key);
        this.b.fire({ key, external });
        return this.D();
      }
      async delete(key, external = false) {
        if (this.c === StorageState.Closed) {
          return;
        }
        const wasDeleted = this.f.delete(key);
        if (!wasDeleted) {
          return;
        }
        if (!this.h.has(key)) {
          this.h.add(key);
        }
        this.j.delete(key);
        this.b.fire({ key, external });
        return this.D();
      }
      async optimize() {
        if (this.c === StorageState.Closed) {
          return;
        }
        await this.flush(0);
        return this.r.optimize();
      }
      async close() {
        if (!this.m) {
          this.m = this.y();
        }
        return this.m;
      }
      async y() {
        this.c = StorageState.Closed;
        try {
          await this.D(
            0
            /* as soon as possible */
          );
        } catch (error) {
        }
        await this.r.close(() => this.f);
      }
      get z() {
        return this.j.size > 0 || this.h.size > 0;
      }
      async C() {
        if (!this.z) {
          return;
        }
        const updateRequest = { insert: this.j, delete: this.h };
        this.h = /* @__PURE__ */ new Set();
        this.j = /* @__PURE__ */ new Map();
        return this.r.updateItems(updateRequest).finally(() => {
          if (!this.z) {
            while (this.n.length) {
              this.n.pop()?.();
            }
          }
        });
      }
      async flush(delay) {
        if (this.c === StorageState.Closed || // Return early if we are already closed
        this.m) {
          return;
        }
        return this.D(delay);
      }
      async D(delay) {
        if (this.s.hint === StorageHint.STORAGE_IN_MEMORY) {
          return this.C();
        }
        return this.g.trigger(() => this.C(), delay);
      }
      async whenFlushed() {
        if (!this.z) {
          return;
        }
        return new Promise((resolve4) => this.n.push(resolve4));
      }
      isInMemory() {
        return this.s.hint === StorageHint.STORAGE_IN_MEMORY;
      }
    };
  }
});

// out-build/vs/platform/workspace/common/workspace.js
function $1k(obj) {
  const singleFolderIdentifier = obj;
  return typeof singleFolderIdentifier?.id === "string" && URI.isUri(singleFolderIdentifier.uri);
}
function $6k(obj) {
  const workspaceIdentifier = obj;
  return typeof workspaceIdentifier?.id === "string" && URI.isUri(workspaceIdentifier.configPath);
}
function $jl(path7) {
  const ext = typeof path7 === "string" ? $sc(path7) : $th(path7);
  return ext === $bl;
}
var $Zk, WorkbenchState, $al, $bl, $cl;
var init_workspace = __esm({
  "out-build/vs/platform/workspace/common/workspace.js"() {
    "use strict";
    init_nls2();
    init_path();
    init_ternarySearchTree();
    init_resources();
    init_uri();
    init_instantiation();
    init_network();
    $Zk = $Qk("contextService");
    (function(WorkbenchState2) {
      WorkbenchState2[WorkbenchState2["EMPTY"] = 1] = "EMPTY";
      WorkbenchState2[WorkbenchState2["FOLDER"] = 2] = "FOLDER";
      WorkbenchState2[WorkbenchState2["WORKSPACE"] = 3] = "WORKSPACE";
    })(WorkbenchState || (WorkbenchState = {}));
    $al = "code-workspace";
    $bl = `.${$al}`;
    $cl = [{ name: localize(2536, null), extensions: [$al] }];
  }
});

// out-build/vs/platform/uriIdentity/common/uriIdentity.js
var $vl;
var init_uriIdentity = __esm({
  "out-build/vs/platform/uriIdentity/common/uriIdentity.js"() {
    "use strict";
    init_instantiation();
    $vl = $Qk("IUriIdentityService");
  }
});

// out-build/vs/platform/userDataProfile/common/userDataProfile.js
function $qs(thing) {
  const candidate = thing;
  return !!(candidate && typeof candidate === "object" && typeof candidate.id === "string" && typeof candidate.isDefault === "boolean" && typeof candidate.name === "string" && URI.isUri(candidate.location) && URI.isUri(candidate.globalStorageHome) && URI.isUri(candidate.settingsResource) && URI.isUri(candidate.keybindingsResource) && URI.isUri(candidate.tasksResource) && URI.isUri(candidate.snippetsHome) && URI.isUri(candidate.extensionsResource));
}
function $ss(profile, scheme) {
  return {
    id: profile.id,
    isDefault: profile.isDefault,
    name: profile.name,
    icon: profile.icon,
    location: URI.revive(profile.location).with({ scheme }),
    globalStorageHome: URI.revive(profile.globalStorageHome).with({ scheme }),
    settingsResource: URI.revive(profile.settingsResource).with({ scheme }),
    keybindingsResource: URI.revive(profile.keybindingsResource).with({ scheme }),
    tasksResource: URI.revive(profile.tasksResource).with({ scheme }),
    snippetsHome: URI.revive(profile.snippetsHome).with({ scheme }),
    extensionsResource: URI.revive(profile.extensionsResource).with({ scheme }),
    cacheHome: URI.revive(profile.cacheHome).with({ scheme }),
    useDefaultFlags: profile.useDefaultFlags,
    isTransient: profile.isTransient,
    workspaces: profile.workspaces?.map((w) => URI.revive(w))
  };
}
function $ts(id2, name, location2, profilesCacheHome, options2, defaultProfile) {
  return {
    id: id2,
    name,
    location: location2,
    isDefault: false,
    icon: options2?.icon,
    globalStorageHome: defaultProfile && options2?.useDefaultFlags?.globalState ? defaultProfile.globalStorageHome : $vh(location2, "globalStorage"),
    settingsResource: defaultProfile && options2?.useDefaultFlags?.settings ? defaultProfile.settingsResource : $vh(location2, "settings.json"),
    keybindingsResource: defaultProfile && options2?.useDefaultFlags?.keybindings ? defaultProfile.keybindingsResource : $vh(location2, "keybindings.json"),
    tasksResource: defaultProfile && options2?.useDefaultFlags?.tasks ? defaultProfile.tasksResource : $vh(location2, "tasks.json"),
    snippetsHome: defaultProfile && options2?.useDefaultFlags?.snippets ? defaultProfile.snippetsHome : $vh(location2, "snippets"),
    extensionsResource: defaultProfile && options2?.useDefaultFlags?.extensions ? defaultProfile.extensionsResource : $vh(location2, "extensions.json"),
    cacheHome: $vh(profilesCacheHome, id2),
    useDefaultFlags: options2?.useDefaultFlags,
    isTransient: options2?.transient,
    workspaces: options2?.workspaces
  };
}
var ProfileResourceType, $rs, $us;
var init_userDataProfile = __esm({
  "out-build/vs/platform/userDataProfile/common/userDataProfile.js"() {
    "use strict";
    init_hash();
    init_event();
    init_lifecycle();
    init_resources();
    init_uri();
    init_nls2();
    init_environment();
    init_files();
    init_instantiation();
    init_log();
    init_workspace();
    init_uriIdentity();
    init_async();
    init_uuid();
    init_strings();
    init_types();
    (function(ProfileResourceType2) {
      ProfileResourceType2["Settings"] = "settings";
      ProfileResourceType2["Keybindings"] = "keybindings";
      ProfileResourceType2["Snippets"] = "snippets";
      ProfileResourceType2["Tasks"] = "tasks";
      ProfileResourceType2["Extensions"] = "extensions";
      ProfileResourceType2["GlobalState"] = "globalState";
    })(ProfileResourceType || (ProfileResourceType = {}));
    $rs = $Qk("IUserDataProfilesService");
    $us = class $us2 extends $3c {
      static {
        this.b = "userDataProfiles";
      }
      static {
        this.c = "profileAssociations";
      }
      get defaultProfile() {
        return this.profiles[0];
      }
      get profiles() {
        return [...this.C.profiles, ...this.r.profiles];
      }
      constructor(s, t, u, y) {
        super();
        this.s = s;
        this.t = t;
        this.u = u;
        this.y = y;
        this.g = this.B(new $ze());
        this.onDidChangeProfiles = this.g.event;
        this.h = this.B(new $ze());
        this.onWillCreateProfile = this.h.event;
        this.j = this.B(new $ze());
        this.onWillRemoveProfile = this.j.event;
        this.m = this.B(new $ze());
        this.onDidResetWorkspaces = this.m.event;
        this.n = /* @__PURE__ */ new Map();
        this.r = {
          profiles: [],
          emptyWindows: /* @__PURE__ */ new Map()
        };
        this.profilesHome = $vh(this.s.userRoamingDataHome, "profiles");
        this.f = $vh(this.s.cacheHome, "CachedProfilesData");
      }
      init() {
        this.z = void 0;
      }
      get C() {
        if (!this.z) {
          const defaultProfile = this.D();
          const profiles = [defaultProfile];
          try {
            for (const storedProfile of this.N()) {
              if (!storedProfile.name || !$zg(storedProfile.name) || !storedProfile.location) {
                this.y.warn("Skipping the invalid stored profile", storedProfile.location || storedProfile.name);
                continue;
              }
              profiles.push($ts($sh(storedProfile.location), storedProfile.name, storedProfile.location, this.f, { icon: storedProfile.icon, useDefaultFlags: storedProfile.useDefaultFlags }, defaultProfile));
            }
          } catch (error) {
            this.y.error(error);
          }
          const emptyWindows = /* @__PURE__ */ new Map();
          if (profiles.length) {
            try {
              const profileAssociaitions = this.P();
              if (profileAssociaitions.workspaces) {
                for (const [workspacePath, profileId] of Object.entries(profileAssociaitions.workspaces)) {
                  const workspace = URI.parse(workspacePath);
                  const profile = profiles.find((p) => p.id === profileId);
                  if (profile) {
                    const workspaces = profile.workspaces ? profile.workspaces.slice(0) : [];
                    workspaces.push(workspace);
                    profile.workspaces = workspaces;
                  }
                }
              }
              if (profileAssociaitions.emptyWindows) {
                for (const [windowId, profileId] of Object.entries(profileAssociaitions.emptyWindows)) {
                  const profile = profiles.find((p) => p.id === profileId);
                  if (profile) {
                    emptyWindows.set(windowId, profile);
                  }
                }
              }
            } catch (error) {
              this.y.error(error);
            }
          }
          this.z = { profiles, emptyWindows };
        }
        return this.z;
      }
      D() {
        const defaultProfile = $ts("__default__profile__", localize(2489, null), this.s.userRoamingDataHome, this.f);
        return { ...defaultProfile, extensionsResource: this.R() ?? defaultProfile.extensionsResource, isDefault: true };
      }
      async createTransientProfile(workspaceIdentifier) {
        const namePrefix = `Temp`;
        const nameRegEx = new RegExp(`${$Af(namePrefix)}\\s(\\d+)`);
        let nameIndex = 0;
        for (const profile of this.profiles) {
          const matches = nameRegEx.exec(profile.name);
          const index = matches ? parseInt(matches[1]) : 0;
          nameIndex = index > nameIndex ? index : nameIndex;
        }
        const name = `${namePrefix} ${nameIndex + 1}`;
        return this.createProfile($Xi($ps()).toString(16), name, { transient: true }, workspaceIdentifier);
      }
      async createNamedProfile(name, options2, workspaceIdentifier) {
        return this.createProfile($Xi($ps()).toString(16), name, options2, workspaceIdentifier);
      }
      async createProfile(id2, name, options2, workspaceIdentifier) {
        const profile = await this.F(id2, name, options2, workspaceIdentifier);
        return profile;
      }
      async F(id2, name, options2, workspaceIdentifier) {
        if (!$zg(name) || !name) {
          throw new Error("Name of the profile is mandatory and must be of type `string`");
        }
        let profileCreationPromise = this.n.get(name);
        if (!profileCreationPromise) {
          profileCreationPromise = (async () => {
            try {
              const existing = this.profiles.find((p) => p.id === id2 || !p.isTransient && !options2?.transient && p.name === name);
              if (existing) {
                throw new Error(`Profile with ${name} name already exists`);
              }
              const workspace = workspaceIdentifier ? this.G(workspaceIdentifier) : void 0;
              if (URI.isUri(workspace)) {
                options2 = { ...options2, workspaces: [workspace] };
              }
              const profile = $ts(id2, name, $vh(this.profilesHome, id2), this.f, options2, this.defaultProfile);
              await this.t.createFolder(profile.location);
              const joiners = [];
              this.h.fire({
                profile,
                join(promise) {
                  joiners.push(promise);
                }
              });
              await Promises.settled(joiners);
              if (workspace && !URI.isUri(workspace)) {
                this.L(workspace, profile, !!profile.isTransient);
              }
              this.I([profile], [], []);
              return profile;
            } finally {
              this.n.delete(name);
            }
          })();
          this.n.set(name, profileCreationPromise);
        }
        return profileCreationPromise;
      }
      async updateProfile(profile, options2) {
        const profilesToUpdate = [];
        for (const existing of this.profiles) {
          let profileToUpdate;
          if (profile.id === existing.id) {
            if (!existing.isDefault) {
              profileToUpdate = $ts(existing.id, options2.name ?? existing.name, existing.location, this.f, {
                icon: options2.icon === null ? void 0 : options2.icon ?? existing.icon,
                transient: options2.transient ?? existing.isTransient,
                useDefaultFlags: options2.useDefaultFlags ?? existing.useDefaultFlags,
                workspaces: options2.workspaces ?? existing.workspaces
              }, this.defaultProfile);
            } else if (options2.workspaces) {
              profileToUpdate = existing;
              profileToUpdate.workspaces = options2.workspaces;
            }
          } else if (options2.workspaces) {
            const workspaces = existing.workspaces?.filter((w1) => !options2.workspaces?.some((w2) => this.u.extUri.isEqual(w1, w2)));
            if (existing.workspaces?.length !== workspaces?.length) {
              profileToUpdate = existing;
              profileToUpdate.workspaces = workspaces;
            }
          }
          if (profileToUpdate) {
            profilesToUpdate.push(profileToUpdate);
          }
        }
        if (!profilesToUpdate.length) {
          if (profile.isDefault) {
            throw new Error("Cannot update default profile");
          }
          throw new Error(`Profile '${profile.name}' does not exist`);
        }
        this.I([], [], profilesToUpdate);
        const updatedProfile = this.profiles.find((p) => p.id === profile.id);
        if (!updatedProfile) {
          throw new Error(`Profile '${profile.name}' was not updated`);
        }
        return updatedProfile;
      }
      async removeProfile(profileToRemove) {
        if (profileToRemove.isDefault) {
          throw new Error("Cannot remove default profile");
        }
        const profile = this.profiles.find((p) => p.id === profileToRemove.id);
        if (!profile) {
          throw new Error(`Profile '${profileToRemove.name}' does not exist`);
        }
        const joiners = [];
        this.j.fire({
          profile,
          join(promise) {
            joiners.push(promise);
          }
        });
        try {
          await Promise.allSettled(joiners);
        } catch (error) {
          this.y.error(error);
        }
        this.I([], [profile], []);
        try {
          await this.t.del(profile.cacheHome, { recursive: true });
        } catch (error) {
          if ($Bm(error) !== 1) {
            this.y.error(error);
          }
        }
      }
      async setProfileForWorkspace(workspaceIdentifier, profileToSet) {
        const profile = this.profiles.find((p) => p.id === profileToSet.id);
        if (!profile) {
          throw new Error(`Profile '${profileToSet.name}' does not exist`);
        }
        const workspace = this.G(workspaceIdentifier);
        if (URI.isUri(workspace)) {
          const workspaces = profile.workspaces ? [...profile.workspaces] : [];
          if (!workspaces.some((w) => this.u.extUri.isEqual(w, workspace))) {
            workspaces.push(workspace);
            await this.updateProfile(profile, { workspaces });
          }
        } else {
          this.L(workspace, profile, false);
          this.M(this.profiles);
        }
      }
      unsetWorkspace(workspaceIdentifier, transient = false) {
        const workspace = this.G(workspaceIdentifier);
        if (URI.isUri(workspace)) {
          const currentlyAssociatedProfile = this.getProfileForWorkspace(workspaceIdentifier);
          if (currentlyAssociatedProfile) {
            this.updateProfile(currentlyAssociatedProfile, { workspaces: currentlyAssociatedProfile.workspaces?.filter((w) => !this.u.extUri.isEqual(w, workspace)) });
          }
        } else {
          this.L(workspace, void 0, transient);
          this.M(this.profiles);
        }
      }
      async resetWorkspaces() {
        this.r.emptyWindows.clear();
        this.C.emptyWindows.clear();
        for (const profile of this.profiles) {
          profile.workspaces = void 0;
        }
        this.I([], [], this.profiles);
        this.m.fire();
      }
      async cleanUp() {
        if (await this.t.exists(this.profilesHome)) {
          const stat = await this.t.resolve(this.profilesHome);
          await Promise.all((stat.children || []).filter((child) => child.isDirectory && this.profiles.every((p) => !this.u.extUri.isEqual(p.location, child.resource))).map((child) => this.t.del(child.resource, { recursive: true })));
        }
      }
      async cleanUpTransientProfiles() {
        const unAssociatedTransientProfiles = this.r.profiles.filter((p) => !this.H(p));
        await Promise.allSettled(unAssociatedTransientProfiles.map((p) => this.removeProfile(p)));
      }
      getProfileForWorkspace(workspaceIdentifier) {
        const workspace = this.G(workspaceIdentifier);
        return URI.isUri(workspace) ? this.profiles.find((p) => p.workspaces?.some((w) => this.u.extUri.isEqual(w, workspace))) : this.C.emptyWindows.get(workspace) ?? this.r.emptyWindows.get(workspace);
      }
      G(workspaceIdentifier) {
        if ($1k(workspaceIdentifier)) {
          return workspaceIdentifier.uri;
        }
        if ($6k(workspaceIdentifier)) {
          return workspaceIdentifier.configPath;
        }
        return workspaceIdentifier.id;
      }
      H(profile) {
        if (profile.workspaces?.length) {
          return true;
        }
        if ([...this.C.emptyWindows.values()].some((windowProfile) => this.u.extUri.isEqual(windowProfile.location, profile.location))) {
          return true;
        }
        if ([...this.r.emptyWindows.values()].some((windowProfile) => this.u.extUri.isEqual(windowProfile.location, profile.location))) {
          return true;
        }
        return false;
      }
      I(added, removed, updated) {
        const allProfiles = [...this.profiles, ...added];
        const transientProfiles = this.r.profiles;
        this.r.profiles = [];
        const profiles = [];
        for (let profile of allProfiles) {
          if (removed.some((p) => profile.id === p.id)) {
            for (const windowId of [...this.C.emptyWindows.keys()]) {
              if (profile.id === this.C.emptyWindows.get(windowId)?.id) {
                this.C.emptyWindows.delete(windowId);
              }
            }
            continue;
          }
          if (!profile.isDefault) {
            profile = updated.find((p) => profile.id === p.id) ?? profile;
            const transientProfile = transientProfiles.find((p) => profile.id === p.id);
            if (profile.isTransient) {
              this.r.profiles.push(profile);
            } else {
              if (transientProfile) {
                for (const [windowId, p] of this.r.emptyWindows.entries()) {
                  if (profile.id === p.id) {
                    this.r.emptyWindows.delete(windowId);
                    this.C.emptyWindows.set(windowId, profile);
                    break;
                  }
                }
              }
            }
          }
          if (profile.workspaces?.length === 0) {
            profile.workspaces = void 0;
          }
          profiles.push(profile);
        }
        this.M(profiles);
        this.J(added, removed, updated);
      }
      J(added, removed, updated) {
        this.g.fire({ added, removed, updated, all: this.profiles });
      }
      L(windowId, newProfile, transient) {
        transient = newProfile?.isTransient ? true : transient;
        if (transient) {
          if (newProfile) {
            this.r.emptyWindows.set(windowId, newProfile);
          } else {
            this.r.emptyWindows.delete(windowId);
          }
        } else {
          this.r.emptyWindows.delete(windowId);
          if (newProfile) {
            this.C.emptyWindows.set(windowId, newProfile);
          } else {
            this.C.emptyWindows.delete(windowId);
          }
        }
      }
      M(profiles) {
        const storedProfiles = [];
        const workspaces = {};
        const emptyWindows = {};
        for (const profile of profiles) {
          if (profile.isTransient) {
            continue;
          }
          if (!profile.isDefault) {
            storedProfiles.push({ location: profile.location, name: profile.name, icon: profile.icon, useDefaultFlags: profile.useDefaultFlags });
          }
          if (profile.workspaces) {
            for (const workspace of profile.workspaces) {
              workspaces[workspace.toString()] = profile.id;
            }
          }
        }
        for (const [windowId, profile] of this.C.emptyWindows.entries()) {
          emptyWindows[windowId.toString()] = profile.id;
        }
        this.Q({ workspaces, emptyWindows });
        this.O(storedProfiles);
        this.z = void 0;
      }
      N() {
        return [];
      }
      O(storedProfiles) {
        throw new Error("not implemented");
      }
      P() {
        return {};
      }
      Q(storedProfileAssociations) {
        throw new Error("not implemented");
      }
      R() {
        return void 0;
      }
    };
    $us = __decorate([
      __param(0, $Xk),
      __param(1, $km),
      __param(2, $vl),
      __param(3, $wn)
    ], $us);
  }
});

// out-build/vs/platform/storage/common/storage.js
function $kv(storage) {
  const keysRaw = storage.get($iv);
  if (keysRaw) {
    try {
      return JSON.parse(keysRaw);
    } catch (error) {
    }
  }
  return /* @__PURE__ */ Object.create(null);
}
function $mv(profile) {
  return profile.isDefault || !!profile.useDefaultFlags?.globalState;
}
async function $ov(application, profile, workspace, applicationPath, profilePath, workspacePath) {
  const safeParse = (value) => {
    try {
      return JSON.parse(value);
    } catch (error) {
      return value;
    }
  };
  const applicationItems = /* @__PURE__ */ new Map();
  const applicationItemsParsed = /* @__PURE__ */ new Map();
  application.forEach((value, key) => {
    applicationItems.set(key, value);
    applicationItemsParsed.set(key, safeParse(value));
  });
  const profileItems = /* @__PURE__ */ new Map();
  const profileItemsParsed = /* @__PURE__ */ new Map();
  profile.forEach((value, key) => {
    profileItems.set(key, value);
    profileItemsParsed.set(key, safeParse(value));
  });
  const workspaceItems = /* @__PURE__ */ new Map();
  const workspaceItemsParsed = /* @__PURE__ */ new Map();
  workspace.forEach((value, key) => {
    workspaceItems.set(key, value);
    workspaceItemsParsed.set(key, safeParse(value));
  });
  if (applicationPath !== profilePath) {
    console.group(`Storage: Application (path: ${applicationPath})`);
  } else {
    console.group(`Storage: Application & Profile (path: ${applicationPath}, default profile)`);
  }
  const applicationValues = [];
  applicationItems.forEach((value, key) => {
    applicationValues.push({ key, value });
  });
  console.table(applicationValues);
  console.groupEnd();
  console.log(applicationItemsParsed);
  if (applicationPath !== profilePath) {
    console.group(`Storage: Profile (path: ${profilePath}, profile specific)`);
    const profileValues = [];
    profileItems.forEach((value, key) => {
      profileValues.push({ key, value });
    });
    console.table(profileValues);
    console.groupEnd();
    console.log(profileItemsParsed);
  }
  console.group(`Storage: Workspace (path: ${workspacePath})`);
  const workspaceValues = [];
  workspaceItems.forEach((value, key) => {
    workspaceValues.push({ key, value });
  });
  console.table(workspaceValues);
  console.groupEnd();
  console.log(workspaceItemsParsed);
}
var $hv, $iv, $jv, WillSaveStateReason, StorageScope, StorageTarget, $lv;
var init_storage2 = __esm({
  "out-build/vs/platform/storage/common/storage.js"() {
    "use strict";
    init_async();
    init_event();
    init_lifecycle();
    init_performance();
    init_types();
    init_storage();
    init_instantiation();
    init_userDataProfile();
    $hv = "__$__isNewStorageMarker";
    $iv = "__$__targetStorageMarker";
    $jv = $Qk("storageService");
    (function(WillSaveStateReason2) {
      WillSaveStateReason2[WillSaveStateReason2["NONE"] = 0] = "NONE";
      WillSaveStateReason2[WillSaveStateReason2["SHUTDOWN"] = 1] = "SHUTDOWN";
    })(WillSaveStateReason || (WillSaveStateReason = {}));
    (function(StorageScope2) {
      StorageScope2[StorageScope2["APPLICATION"] = -1] = "APPLICATION";
      StorageScope2[StorageScope2["PROFILE"] = 0] = "PROFILE";
      StorageScope2[StorageScope2["WORKSPACE"] = 1] = "WORKSPACE";
    })(StorageScope || (StorageScope = {}));
    (function(StorageTarget2) {
      StorageTarget2[StorageTarget2["USER"] = 0] = "USER";
      StorageTarget2[StorageTarget2["MACHINE"] = 1] = "MACHINE";
    })(StorageTarget || (StorageTarget = {}));
    $lv = class _$lv extends $3c {
      static {
        this.a = 60 * 1e3;
      }
      // every minute
      constructor(m = { flushInterval: _$lv.a }) {
        super();
        this.m = m;
        this.b = this.B(new $Ce());
        this.c = this.B(new $Ce());
        this.onDidChangeTarget = this.c.event;
        this.f = this.B(new $ze());
        this.onWillSaveState = this.f.event;
        this.h = this.B(new $8h(() => this.n(), this.m.flushInterval));
        this.j = this.B(new $4c());
        this.C = void 0;
        this.F = void 0;
        this.H = void 0;
      }
      onDidChangeValue(scope, key, disposable) {
        return Event.filter(this.b.event, (e) => e.scope === scope && (key === void 0 || e.key === key), disposable);
      }
      n() {
        this.j.value = $_h(() => {
          if (this.r()) {
            this.flush();
          }
          this.h.schedule();
        });
      }
      r() {
        return true;
      }
      t() {
        $Xc([this.j, this.h]);
      }
      initialize() {
        if (!this.g) {
          this.g = (async () => {
            $S("code/willInitStorage");
            try {
              await this.O();
            } finally {
              $S("code/didInitStorage");
            }
            this.h.schedule();
          })();
        }
        return this.g;
      }
      u(scope, event) {
        const { key, external } = event;
        if (key === $iv) {
          switch (scope) {
            case -1:
              this.H = void 0;
              break;
            case 0:
              this.F = void 0;
              break;
            case 1:
              this.C = void 0;
              break;
          }
          this.c.fire({ scope });
        } else {
          this.b.fire({ scope, key, target: this.J(scope)[key], external });
        }
      }
      w(reason) {
        this.f.fire({ reason });
      }
      get(key, scope, fallbackValue) {
        return this.P(scope)?.get(key, fallbackValue);
      }
      getBoolean(key, scope, fallbackValue) {
        return this.P(scope)?.getBoolean(key, fallbackValue);
      }
      getNumber(key, scope, fallbackValue) {
        return this.P(scope)?.getNumber(key, fallbackValue);
      }
      getObject(key, scope, fallbackValue) {
        return this.P(scope)?.getObject(key, fallbackValue);
      }
      storeAll(entries, external) {
        this.y(() => {
          for (const entry of entries) {
            this.store(entry.key, entry.value, entry.scope, entry.target, external);
          }
        });
      }
      store(key, value, scope, target, external = false) {
        if ($Ig(value)) {
          this.remove(key, scope, external);
          return;
        }
        this.y(() => {
          this.z(key, scope, target);
          this.P(scope)?.set(key, value, external);
        });
      }
      remove(key, scope, external = false) {
        this.y(() => {
          this.z(key, scope, void 0);
          this.P(scope)?.delete(key, external);
        });
      }
      y(fn) {
        this.b.pause();
        this.c.pause();
        try {
          fn();
        } finally {
          this.b.resume();
          this.c.resume();
        }
      }
      keys(scope, target) {
        const keys = [];
        const keyTargets = this.J(scope);
        for (const key of Object.keys(keyTargets)) {
          const keyTarget = keyTargets[key];
          if (keyTarget === target) {
            keys.push(key);
          }
        }
        return keys;
      }
      z(key, scope, target, external = false) {
        const keyTargets = this.J(scope);
        if (typeof target === "number") {
          if (keyTargets[key] !== target) {
            keyTargets[key] = target;
            this.P(scope)?.set($iv, JSON.stringify(keyTargets), external);
          }
        } else {
          if (typeof keyTargets[key] === "number") {
            delete keyTargets[key];
            this.P(scope)?.set($iv, JSON.stringify(keyTargets), external);
          }
        }
      }
      get D() {
        if (!this.C) {
          this.C = this.L(
            1
            /* StorageScope.WORKSPACE */
          );
        }
        return this.C;
      }
      get G() {
        if (!this.F) {
          this.F = this.L(
            0
            /* StorageScope.PROFILE */
          );
        }
        return this.F;
      }
      get I() {
        if (!this.H) {
          this.H = this.L(
            -1
            /* StorageScope.APPLICATION */
          );
        }
        return this.H;
      }
      J(scope) {
        switch (scope) {
          case -1:
            return this.I;
          case 0:
            return this.G;
          default:
            return this.D;
        }
      }
      L(scope) {
        const storage = this.P(scope);
        return storage ? $kv(storage) : /* @__PURE__ */ Object.create(null);
      }
      isNew(scope) {
        return this.getBoolean($hv, scope) === true;
      }
      async flush(reason = WillSaveStateReason.NONE) {
        this.f.fire({ reason });
        const applicationStorage = this.P(
          -1
          /* StorageScope.APPLICATION */
        );
        const profileStorage = this.P(
          0
          /* StorageScope.PROFILE */
        );
        const workspaceStorage = this.P(
          1
          /* StorageScope.WORKSPACE */
        );
        switch (reason) {
          case WillSaveStateReason.NONE:
            await Promises.settled([
              applicationStorage?.whenFlushed() ?? Promise.resolve(),
              profileStorage?.whenFlushed() ?? Promise.resolve(),
              workspaceStorage?.whenFlushed() ?? Promise.resolve()
            ]);
            break;
          case WillSaveStateReason.SHUTDOWN:
            await Promises.settled([
              applicationStorage?.flush(0) ?? Promise.resolve(),
              profileStorage?.flush(0) ?? Promise.resolve(),
              workspaceStorage?.flush(0) ?? Promise.resolve()
            ]);
            break;
        }
      }
      async log() {
        const applicationItems = this.P(
          -1
          /* StorageScope.APPLICATION */
        )?.items ?? /* @__PURE__ */ new Map();
        const profileItems = this.P(
          0
          /* StorageScope.PROFILE */
        )?.items ?? /* @__PURE__ */ new Map();
        const workspaceItems = this.P(
          1
          /* StorageScope.WORKSPACE */
        )?.items ?? /* @__PURE__ */ new Map();
        return $ov(applicationItems, profileItems, workspaceItems, this.Q(
          -1
          /* StorageScope.APPLICATION */
        ) ?? "", this.Q(
          0
          /* StorageScope.PROFILE */
        ) ?? "", this.Q(
          1
          /* StorageScope.WORKSPACE */
        ) ?? "");
      }
      async optimize(scope) {
        await this.flush();
        return this.P(scope)?.optimize();
      }
      async switch(to, preserveData) {
        this.w(WillSaveStateReason.NONE);
        if ($qs(to)) {
          return this.R(to, preserveData);
        }
        return this.S(to, preserveData);
      }
      M(from, to) {
        if (from.id === to.id) {
          return false;
        }
        if ($mv(to) && $mv(from)) {
          return false;
        }
        return true;
      }
      N(oldStorage, newStorage, scope) {
        this.y(() => {
          const handledkeys = /* @__PURE__ */ new Set();
          for (const [key, oldValue] of oldStorage) {
            handledkeys.add(key);
            const newValue = newStorage.get(key);
            if (newValue !== oldValue) {
              this.u(scope, { key, external: true });
            }
          }
          for (const [key] of newStorage.items) {
            if (!handledkeys.has(key)) {
              this.u(scope, { key, external: true });
            }
          }
        });
      }
    };
  }
});

// out-build/vs/platform/extensionManagement/common/extensionGalleryService.js
function flagsToString(...flags) {
  return String(flags.reduce((r, f) => r | f, 0));
}
function getStatistic(statistics, name) {
  const result = (statistics || []).filter((s) => s.statisticName === name)[0];
  return result ? result.value : 0;
}
function getCoreTranslationAssets(version) {
  const coreTranslationAssetPrefix = "Microsoft.VisualStudio.Code.Translation.";
  const result = version.files.filter((f) => f.assetType.indexOf(coreTranslationAssetPrefix) === 0);
  return result.reduce((result2, file) => {
    const asset = getVersionAsset(version, file.assetType);
    if (asset) {
      result2.push([file.assetType.substring(coreTranslationAssetPrefix.length), asset]);
    }
    return result2;
  }, []);
}
function getRepositoryAsset(version) {
  if (version.properties) {
    const results = version.properties.filter((p) => p.key === AssetType.Repository);
    const gitRegExp = new RegExp("((git|ssh|http(s)?)|(git@[\\w.]+))(:(//)?)([\\w.@:/\\-~]+)(.git)(/)?");
    const uri = results.filter((r) => gitRegExp.test(r.value))[0];
    return uri ? { uri: uri.value, fallbackUri: uri.value } : null;
  }
  return getVersionAsset(version, AssetType.Repository);
}
function getDownloadAsset(version) {
  return {
    // always use fallbackAssetUri for download asset to hit the Marketplace API so that downloads are counted
    uri: `${version.fallbackAssetUri}/${AssetType.VSIX}?redirect=true${version.targetPlatform ? `&targetPlatform=${version.targetPlatform}` : ""}`,
    fallbackUri: `${version.fallbackAssetUri}/${AssetType.VSIX}${version.targetPlatform ? `?targetPlatform=${version.targetPlatform}` : ""}`
  };
}
function getVersionAsset(version, type2) {
  const result = version.files.filter((f) => f.assetType === type2)[0];
  return result ? {
    uri: `${version.assetUri}/${type2}${version.targetPlatform ? `?targetPlatform=${version.targetPlatform}` : ""}`,
    fallbackUri: `${version.fallbackAssetUri}/${type2}${version.targetPlatform ? `?targetPlatform=${version.targetPlatform}` : ""}`
  } : null;
}
function getExtensions(version, property) {
  const values = version.properties ? version.properties.filter((p) => p.key === property) : [];
  const value = values.length > 0 && values[0].value;
  return value ? value.split(",").map((v) => $HA(v)) : [];
}
function getEngine(version) {
  const values = version.properties ? version.properties.filter((p) => p.key === PropertyType.Engine) : [];
  return values.length > 0 && values[0].value || "";
}
function isPreReleaseVersion(version) {
  const values = version.properties ? version.properties.filter((p) => p.key === PropertyType.PreRelease) : [];
  return values.length > 0 && values[0].value === "true";
}
function executesCode(version) {
  const values = version.properties ? version.properties.filter((p) => p.key === PropertyType.ExecutesCode) : [];
  return values.length > 0 ? values[0].value === "true" : void 0;
}
function getEnabledApiProposals(version) {
  const values = version.properties ? version.properties.filter((p) => p.key === PropertyType.EnabledApiProposals) : [];
  const value = values.length > 0 && values[0].value || "";
  return value ? value.split(",") : [];
}
function getLocalizedLanguages(version) {
  const values = version.properties ? version.properties.filter((p) => p.key === PropertyType.LocalizedLanguages) : [];
  const value = values.length > 0 && values[0].value || "";
  return value ? value.split(",") : [];
}
function getSponsorLink(version) {
  return version.properties?.find((p) => p.key === PropertyType.SponsorLink)?.value;
}
function getSupportLink(version) {
  return version.properties?.find((p) => p.key === PropertyType.SupportLink)?.value;
}
function getIsPreview(flags) {
  return flags.indexOf("preview") !== -1;
}
function getTargetPlatformForExtensionVersion(version) {
  return version.targetPlatform ? $kA(version.targetPlatform) : "undefined";
}
function getAllTargetPlatforms(rawGalleryExtension) {
  const allTargetPlatforms = $Rb(rawGalleryExtension.versions.map(getTargetPlatformForExtensionVersion));
  const isWebExtension = !!rawGalleryExtension.tags?.includes($eA);
  const webTargetPlatformIndex = allTargetPlatforms.indexOf(
    "web"
    /* TargetPlatform.WEB */
  );
  if (isWebExtension) {
    if (webTargetPlatformIndex === -1) {
      allTargetPlatforms.push(
        "web"
        /* TargetPlatform.WEB */
      );
    }
  } else {
    if (webTargetPlatformIndex !== -1) {
      allTargetPlatforms.splice(webTargetPlatformIndex, 1);
    }
  }
  return allTargetPlatforms;
}
function $9W(versions, preferredTargetPlatform) {
  for (let index = 0; index < versions.length; index++) {
    const version = versions[index];
    if (version.version === versions[index - 1]?.version) {
      let insertionIndex = index;
      const versionTargetPlatform = getTargetPlatformForExtensionVersion(version);
      if (versionTargetPlatform === preferredTargetPlatform) {
        while (insertionIndex > 0 && versions[insertionIndex - 1].version === version.version) {
          insertionIndex--;
        }
      }
      if (insertionIndex !== index) {
        versions.splice(index, 1);
        versions.splice(insertionIndex, 0, version);
      }
    }
  }
  return versions;
}
function setTelemetry(extension, index, querySource) {
  extension.telemetryData = { index, querySource, queryActivityId: extension.queryContext?.[ACTIVITY_HEADER_NAME] };
}
function toExtension(galleryExtension, version, allTargetPlatforms, queryContext) {
  const latestVersion = galleryExtension.versions[0];
  const assets = {
    manifest: getVersionAsset(version, AssetType.Manifest),
    readme: getVersionAsset(version, AssetType.Details),
    changelog: getVersionAsset(version, AssetType.Changelog),
    license: getVersionAsset(version, AssetType.License),
    repository: getRepositoryAsset(version),
    download: getDownloadAsset(version),
    icon: getVersionAsset(version, AssetType.Icon),
    signature: getVersionAsset(version, AssetType.Signature),
    coreTranslations: getCoreTranslationAssets(version)
  };
  return {
    type: "gallery",
    identifier: {
      id: $IA(galleryExtension.publisher.publisherName, galleryExtension.extensionName),
      uuid: galleryExtension.extensionId
    },
    name: galleryExtension.extensionName,
    version: version.version,
    displayName: galleryExtension.displayName,
    publisherId: galleryExtension.publisher.publisherId,
    publisher: galleryExtension.publisher.publisherName,
    publisherDisplayName: galleryExtension.publisher.displayName,
    publisherDomain: galleryExtension.publisher.domain ? { link: galleryExtension.publisher.domain, verified: !!galleryExtension.publisher.isDomainVerified } : void 0,
    publisherSponsorLink: getSponsorLink(latestVersion),
    description: galleryExtension.shortDescription ?? "",
    installCount: getStatistic(galleryExtension.statistics, "install"),
    rating: getStatistic(galleryExtension.statistics, "averagerating"),
    ratingCount: getStatistic(galleryExtension.statistics, "ratingcount"),
    categories: galleryExtension.categories || [],
    tags: galleryExtension.tags || [],
    releaseDate: Date.parse(galleryExtension.releaseDate),
    lastUpdated: Date.parse(galleryExtension.lastUpdated),
    allTargetPlatforms,
    assets,
    properties: {
      dependencies: getExtensions(version, PropertyType.Dependency),
      extensionPack: getExtensions(version, PropertyType.ExtensionPack),
      engine: getEngine(version),
      enabledApiProposals: getEnabledApiProposals(version),
      localizedLanguages: getLocalizedLanguages(version),
      targetPlatform: getTargetPlatformForExtensionVersion(version),
      isPreReleaseVersion: isPreReleaseVersion(version),
      executesCode: executesCode(version)
    },
    hasPreReleaseVersion: isPreReleaseVersion(latestVersion),
    hasReleaseVersion: true,
    preview: getIsPreview(galleryExtension.flags),
    isSigned: !!assets.signature,
    queryContext,
    supportLink: getSupportLink(latestVersion)
  };
}
var CURRENT_TARGET_PLATFORM, ACTIVITY_HEADER_NAME, Flags, FilterType, AssetType, PropertyType, DefaultPageSize, DefaultQueryState, Query, AbstractExtensionGalleryService, $0W, $$W;
var init_extensionGalleryService = __esm({
  "out-build/vs/platform/extensionManagement/common/extensionGalleryService.js"() {
    "use strict";
    init_arrays();
    init_cancellation();
    init_errors();
    init_platform();
    init_process();
    init_types();
    init_uri();
    init_request2();
    init_configuration();
    init_environment();
    init_extensionManagement();
    init_extensionManagementUtil();
    init_extensionValidator();
    init_files();
    init_log();
    init_productService();
    init_request();
    init_marketplace();
    init_storage2();
    init_telemetry();
    init_stopwatch();
    init_strings();
    CURRENT_TARGET_PLATFORM = $r ? "web" : $lA($x, $ic);
    ACTIVITY_HEADER_NAME = "X-Market-Search-Activity-Id";
    (function(Flags2) {
      Flags2[Flags2["None"] = 0] = "None";
      Flags2[Flags2["IncludeVersions"] = 1] = "IncludeVersions";
      Flags2[Flags2["IncludeFiles"] = 2] = "IncludeFiles";
      Flags2[Flags2["IncludeCategoryAndTags"] = 4] = "IncludeCategoryAndTags";
      Flags2[Flags2["IncludeSharedAccounts"] = 8] = "IncludeSharedAccounts";
      Flags2[Flags2["IncludeVersionProperties"] = 16] = "IncludeVersionProperties";
      Flags2[Flags2["ExcludeNonValidated"] = 32] = "ExcludeNonValidated";
      Flags2[Flags2["IncludeInstallationTargets"] = 64] = "IncludeInstallationTargets";
      Flags2[Flags2["IncludeAssetUri"] = 128] = "IncludeAssetUri";
      Flags2[Flags2["IncludeStatistics"] = 256] = "IncludeStatistics";
      Flags2[Flags2["IncludeLatestVersionOnly"] = 512] = "IncludeLatestVersionOnly";
      Flags2[Flags2["Unpublished"] = 4096] = "Unpublished";
      Flags2[Flags2["IncludeNameConflictInfo"] = 32768] = "IncludeNameConflictInfo";
    })(Flags || (Flags = {}));
    (function(FilterType2) {
      FilterType2[FilterType2["Tag"] = 1] = "Tag";
      FilterType2[FilterType2["ExtensionId"] = 4] = "ExtensionId";
      FilterType2[FilterType2["Category"] = 5] = "Category";
      FilterType2[FilterType2["ExtensionName"] = 7] = "ExtensionName";
      FilterType2[FilterType2["Target"] = 8] = "Target";
      FilterType2[FilterType2["Featured"] = 9] = "Featured";
      FilterType2[FilterType2["SearchText"] = 10] = "SearchText";
      FilterType2[FilterType2["ExcludeWithFlags"] = 12] = "ExcludeWithFlags";
    })(FilterType || (FilterType = {}));
    AssetType = {
      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"
    };
    PropertyType = {
      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"
    };
    DefaultPageSize = 10;
    DefaultQueryState = {
      pageNumber: 1,
      pageSize: DefaultPageSize,
      sortBy: 0,
      sortOrder: 0,
      flags: Flags.None,
      criteria: [],
      assetTypes: []
    };
    Query = class _Query {
      constructor(d = DefaultQueryState) {
        this.d = d;
      }
      get pageNumber() {
        return this.d.pageNumber;
      }
      get pageSize() {
        return this.d.pageSize;
      }
      get sortBy() {
        return this.d.sortBy;
      }
      get sortOrder() {
        return this.d.sortOrder;
      }
      get flags() {
        return this.d.flags;
      }
      get criteria() {
        return this.d.criteria;
      }
      withPage(pageNumber, pageSize = this.d.pageSize) {
        return new _Query({ ...this.d, pageNumber, pageSize });
      }
      withFilter(filterType, ...values) {
        const criteria = [
          ...this.d.criteria,
          ...values.length ? values.map((value) => ({ filterType, value })) : [{ filterType }]
        ];
        return new _Query({ ...this.d, criteria });
      }
      withSortBy(sortBy) {
        return new _Query({ ...this.d, sortBy });
      }
      withSortOrder(sortOrder) {
        return new _Query({ ...this.d, sortOrder });
      }
      withFlags(...flags) {
        return new _Query({ ...this.d, flags: flags.reduce((r, f) => r | f, 0) });
      }
      withAssetTypes(...assetTypes) {
        return new _Query({ ...this.d, assetTypes });
      }
      withSource(source) {
        return new _Query({ ...this.d, source });
      }
      get raw() {
        const { criteria, pageNumber, pageSize, sortBy, sortOrder, flags, assetTypes } = this.d;
        const filters = [{ criteria, pageNumber, pageSize, sortBy, sortOrder }];
        return { filters, assetTypes, flags };
      }
      get searchText() {
        const criterium = this.d.criteria.filter((criterium2) => criterium2.filterType === FilterType.SearchText)[0];
        return criterium && criterium.value ? criterium.value : "";
      }
      get telemetryData() {
        return {
          filterTypes: this.d.criteria.map((criterium) => String(criterium.filterType)),
          flags: this.d.flags,
          sortBy: String(this.sortBy),
          sortOrder: String(this.sortOrder),
          pageNumber: String(this.pageNumber),
          source: this.d.source,
          searchTextLength: this.searchText.length
        };
      }
    };
    AbstractExtensionGalleryService = class AbstractExtensionGalleryService2 {
      constructor(storageService, n, o, q, u, w, x, y, z) {
        this.n = n;
        this.o = o;
        this.q = q;
        this.u = u;
        this.w = w;
        this.x = x;
        this.y = y;
        this.z = z;
        const config = x.extensionsGallery;
        const isPPEEnabled = config?.servicePPEUrl && y.getValue("_extensionsGallery.enablePPE");
        this.d = isPPEEnabled ? config.servicePPEUrl : config?.serviceUrl;
        this.g = isPPEEnabled ? void 0 : config?.searchUrl;
        this.h = config?.controlUrl;
        this.j = config?.extensionUrlTemplate;
        this.l = x.extensionsEnabledWithApiProposalVersion?.map((id2) => id2.toLowerCase()) ?? [];
        this.k = $qw(x.version, x, this.q, this.y, this.w, storageService, this.u);
      }
      A(path7 = "") {
        return `${this.d}${path7}`;
      }
      isEnabled() {
        return !!this.d;
      }
      async getExtensions(extensionInfos, arg1, arg2) {
        if (!this.isEnabled()) {
          throw new Error("No extension gallery service configured.");
        }
        const options2 = CancellationToken.isCancellationToken(arg1) ? {} : arg1;
        const token = CancellationToken.isCancellationToken(arg1) ? arg1 : arg2;
        const useResourceApi = options2.preferResourceApi && (this.y.getValue($BA) ?? false);
        const result = useResourceApi ? await this.C(extensionInfos, options2, token) : await this.B(extensionInfos, options2, token);
        const uuids = result.map((r) => r.identifier.uuid);
        const extensionInfosByName = [];
        for (const e of extensionInfos) {
          if (e.uuid && !uuids.includes(e.uuid)) {
            extensionInfosByName.push({ ...e, uuid: void 0 });
          }
        }
        if (extensionInfosByName.length) {
          this.u.publicLog2("galleryService:additionalQueryByName", {
            count: extensionInfosByName.length
          });
          const extensions = await this.B(extensionInfosByName, options2, token);
          result.push(...extensions);
        }
        return result;
      }
      async B(extensionInfos, options2, token) {
        const names = [];
        const ids = [], includePreReleases = [], versions = [];
        let isQueryForReleaseVersionFromPreReleaseVersion = true;
        for (const extensionInfo of extensionInfos) {
          if (extensionInfo.uuid) {
            ids.push(extensionInfo.uuid);
          } else {
            names.push(extensionInfo.id);
          }
          const includePreRelease = !!(extensionInfo.version || extensionInfo.preRelease);
          includePreReleases.push({ id: extensionInfo.id, uuid: extensionInfo.uuid, includePreRelease });
          if (extensionInfo.version) {
            versions.push({ id: extensionInfo.id, uuid: extensionInfo.uuid, version: extensionInfo.version });
          }
          isQueryForReleaseVersionFromPreReleaseVersion = isQueryForReleaseVersionFromPreReleaseVersion && (!!extensionInfo.hasPreRelease && !includePreRelease);
        }
        if (!ids.length && !names.length) {
          return [];
        }
        let query = new Query().withPage(1, extensionInfos.length);
        if (ids.length) {
          query = query.withFilter(FilterType.ExtensionId, ...ids);
        }
        if (names.length) {
          query = query.withFilter(FilterType.ExtensionName, ...names);
        }
        if (options2.queryAllVersions || isQueryForReleaseVersionFromPreReleaseVersion) {
          query = query.withFlags(query.flags, Flags.IncludeVersions);
        }
        if (options2.source) {
          query = query.withSource(options2.source);
        }
        const { extensions } = await this.F(query, { targetPlatform: options2.targetPlatform ?? CURRENT_TARGET_PLATFORM, includePreRelease: includePreReleases, versions, compatible: !!options2.compatible, productVersion: options2.productVersion ?? { version: this.x.version, date: this.x.date } }, token);
        if (options2.source) {
          extensions.forEach((e, index) => setTelemetry(e, index, options2.source));
        }
        return extensions;
      }
      async C(extensionInfos, options2, token) {
        const toQuery = [];
        const result = [];
        await Promise.allSettled(extensionInfos.map(async (extensionInfo) => {
          if (extensionInfo.version) {
            toQuery.push(extensionInfo);
            return;
          }
          try {
            const rawGalleryExtension = await this.I(extensionInfo.id, token);
            if (!rawGalleryExtension) {
              toQuery.push(extensionInfo);
              return;
            }
            const extension = await this.G(rawGalleryExtension, {
              targetPlatform: options2.targetPlatform ?? CURRENT_TARGET_PLATFORM,
              includePreRelease: !!extensionInfo.preRelease,
              compatible: !!options2.compatible,
              productVersion: options2.productVersion ?? {
                version: this.x.version,
                date: this.x.date
              }
            });
            if (extension) {
              result.push(extension);
            } else {
              this.u.publicLog2("galleryService:fallbacktoquery", {
                extension: extensionInfo.id,
                preRelease: !!extensionInfo.preRelease,
                compatible: !!options2.compatible
              });
              if (!options2.compatible || this.z.isAllowed({ id: extensionInfo.id, publisherDisplayName: rawGalleryExtension.publisher.displayName }) === true) {
                toQuery.push(extensionInfo);
              }
            }
          } catch (error) {
            this.o.error(`Error while getting the latest version for the extension ${extensionInfo.id}.`, $qb(error));
            toQuery.push(extensionInfo);
          }
        }));
        const extensions = await this.B(toQuery, options2, token);
        result.push(...extensions);
        return result;
      }
      async getCompatibleExtension(extension, includePreRelease, targetPlatform, productVersion = { version: this.x.version, date: this.x.date }) {
        if ($mA(extension.allTargetPlatforms, targetPlatform)) {
          return null;
        }
        if (await this.isExtensionCompatible(extension, includePreRelease, targetPlatform)) {
          return extension;
        }
        if (this.z.isAllowed({ id: extension.identifier.id, publisherDisplayName: extension.publisherDisplayName }) !== true) {
          return null;
        }
        const query = new Query().withFlags(Flags.IncludeVersions).withPage(1, 1).withFilter(FilterType.ExtensionId, extension.identifier.uuid);
        const { extensions } = await this.F(query, { targetPlatform, compatible: true, includePreRelease, productVersion }, CancellationToken.None);
        return extensions[0] || null;
      }
      async isExtensionCompatible(extension, includePreRelease, targetPlatform, productVersion = { version: this.x.version, date: this.x.date }) {
        if (this.z.isAllowed(extension) !== true) {
          return false;
        }
        if (!$nA(extension.properties.targetPlatform, extension.allTargetPlatforms, targetPlatform)) {
          return false;
        }
        if (!includePreRelease && extension.properties.isPreReleaseVersion) {
          return false;
        }
        let engine = extension.properties.engine;
        if (!engine) {
          const manifest = await this.getManifest(extension, CancellationToken.None);
          if (!manifest) {
            throw new Error("Manifest was not found");
          }
          engine = manifest.engines.vscode;
        }
        if (!$1A(engine, productVersion.version, productVersion.date)) {
          return false;
        }
        if (!this.D(extension.identifier, extension.properties.enabledApiProposals)) {
          return false;
        }
        return true;
      }
      D(extensionIdentifier, enabledApiProposals) {
        if (!enabledApiProposals) {
          return true;
        }
        if (!this.l.includes(extensionIdentifier.id.toLowerCase())) {
          return true;
        }
        return $2A(enabledApiProposals);
      }
      async E(extension, rawGalleryExtensionVersion, publisherDisplayName, versionType, compatible, allTargetPlatforms, targetPlatform, productVersion = { version: this.x.version, date: this.x.date }) {
        const targetPlatformForExtension = getTargetPlatformForExtensionVersion(rawGalleryExtensionVersion);
        if (!$nA(targetPlatformForExtension, allTargetPlatforms, targetPlatform)) {
          return false;
        }
        if (versionType !== "any" && isPreReleaseVersion(rawGalleryExtensionVersion) !== (versionType === "prerelease")) {
          return false;
        }
        if (compatible) {
          if (this.z.isAllowed({ id: extension, publisherDisplayName, version: rawGalleryExtensionVersion.version, prerelease: isPreReleaseVersion(rawGalleryExtensionVersion), targetPlatform: targetPlatformForExtension }) !== true) {
            return false;
          }
          try {
            const engine = await this.L(extension, rawGalleryExtensionVersion);
            if (!$1A(engine, productVersion.version, productVersion.date)) {
              return false;
            }
          } catch (error) {
            this.o.error(`Error while getting the engine for the version ${rawGalleryExtensionVersion.version}.`, $qb(error));
            return false;
          }
        }
        return true;
      }
      async query(options2, token) {
        let text = options2.text || "";
        const pageSize = options2.pageSize ?? 50;
        let query = new Query().withPage(1, pageSize);
        if (text) {
          text = text.replace(/\bcategory:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g, (_, quotedCategory, category) => {
            query = query.withFilter(FilterType.Category, category || quotedCategory);
            return "";
          });
          text = text.replace(/\btag:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g, (_, quotedTag, tag2) => {
            query = query.withFilter(FilterType.Tag, tag2 || quotedTag);
            return "";
          });
          text = text.replace(/\bfeatured(\s+|\b|$)/g, () => {
            query = query.withFilter(FilterType.Featured);
            return "";
          });
          text = text.trim();
          if (text) {
            text = text.length < 200 ? text : text.substring(0, 200);
            query = query.withFilter(FilterType.SearchText, text);
          }
          query = query.withSortBy(
            0
            /* SortBy.NoneOrRelevance */
          );
        } else {
          query = query.withSortBy(
            4
            /* SortBy.InstallCount */
          );
        }
        if (typeof options2.sortBy === "number") {
          query = query.withSortBy(options2.sortBy);
        }
        if (typeof options2.sortOrder === "number") {
          query = query.withSortOrder(options2.sortOrder);
        }
        if (options2.source) {
          query = query.withSource(options2.source);
        }
        const runQuery = async (query2, token2) => {
          const { extensions: extensions2, total: total2 } = await this.F(query2, { targetPlatform: CURRENT_TARGET_PLATFORM, compatible: false, includePreRelease: !!options2.includePreRelease, productVersion: options2.productVersion ?? { version: this.x.version, date: this.x.date } }, token2);
          extensions2.forEach((e, index) => setTelemetry(e, (query2.pageNumber - 1) * query2.pageSize + index, options2.source));
          return { extensions: extensions2, total: total2 };
        };
        const { extensions, total } = await runQuery(query, token);
        const getPage = async (pageIndex, ct) => {
          if (ct.isCancellationRequested) {
            throw new $lb();
          }
          const { extensions: extensions2 } = await runQuery(query.withPage(pageIndex + 1), ct);
          return extensions2;
        };
        return { firstPage: extensions, total, pageSize: query.pageSize, getPage };
      }
      async F(query, criteria, token) {
        const flags = query.flags;
        if (!!(query.flags & Flags.IncludeLatestVersionOnly) && !!(query.flags & Flags.IncludeVersions)) {
          query = query.withFlags(query.flags & ~Flags.IncludeVersions, Flags.IncludeLatestVersionOnly);
        }
        if (!(query.flags & Flags.IncludeLatestVersionOnly) && !(query.flags & Flags.IncludeVersions)) {
          query = query.withFlags(query.flags, Flags.IncludeLatestVersionOnly);
        }
        if (criteria.versions?.length) {
          query = query.withFlags(query.flags & ~Flags.IncludeLatestVersionOnly, Flags.IncludeVersions);
        }
        query = query.withFlags(query.flags, Flags.IncludeAssetUri, Flags.IncludeCategoryAndTags, Flags.IncludeFiles, Flags.IncludeStatistics, Flags.IncludeVersionProperties);
        const { galleryExtensions: rawGalleryExtensions, total, context } = await this.H(query, token);
        const hasAllVersions = !(query.flags & Flags.IncludeLatestVersionOnly);
        if (hasAllVersions) {
          const extensions = [];
          for (const rawGalleryExtension of rawGalleryExtensions) {
            const extension = await this.G(rawGalleryExtension, criteria, context);
            if (extension) {
              extensions.push(extension);
            }
          }
          return { extensions, total };
        }
        const result = [];
        const needAllVersions = /* @__PURE__ */ new Map();
        for (let index = 0; index < rawGalleryExtensions.length; index++) {
          const rawGalleryExtension = rawGalleryExtensions[index];
          const extensionIdentifier = { id: $IA(rawGalleryExtension.publisher.publisherName, rawGalleryExtension.extensionName), uuid: rawGalleryExtension.extensionId };
          const includePreRelease = $Fg(criteria.includePreRelease) ? criteria.includePreRelease : !!criteria.includePreRelease.find((extensionIdentifierWithPreRelease) => $DA(extensionIdentifierWithPreRelease, extensionIdentifier))?.includePreRelease;
          if (criteria.compatible) {
            if ($mA(getAllTargetPlatforms(rawGalleryExtension), criteria.targetPlatform)) {
              continue;
            }
            if (this.z.isAllowed({ id: extensionIdentifier.id, publisherDisplayName: rawGalleryExtension.publisher.displayName }) !== true) {
              continue;
            }
          }
          const extension = await this.G(rawGalleryExtension, criteria, context);
          if (!extension || extension.properties.isPreReleaseVersion && (!includePreRelease || !extension.hasReleaseVersion) || !extension.properties.isPreReleaseVersion && extension.properties.targetPlatform !== criteria.targetPlatform && extension.hasPreReleaseVersion) {
            needAllVersions.set(rawGalleryExtension.extensionId, index);
          } else {
            result.push([index, extension]);
          }
        }
        if (needAllVersions.size) {
          const stopWatch = new $te();
          const query2 = new Query().withFlags(flags & ~Flags.IncludeLatestVersionOnly, Flags.IncludeVersions).withPage(1, needAllVersions.size).withFilter(FilterType.ExtensionId, ...needAllVersions.keys());
          const { extensions } = await this.F(query2, criteria, token);
          this.u.publicLog2("galleryService:additionalQuery", {
            duration: stopWatch.elapsed(),
            count: needAllVersions.size
          });
          for (const extension of extensions) {
            const index = needAllVersions.get(extension.identifier.uuid);
            result.push([index, extension]);
          }
        }
        return { extensions: result.sort((a, b) => a[0] - b[0]).map(([, extension]) => extension), total };
      }
      async G(rawGalleryExtension, criteria, queryContext) {
        const extensionIdentifier = { id: $IA(rawGalleryExtension.publisher.publisherName, rawGalleryExtension.extensionName), uuid: rawGalleryExtension.extensionId };
        const version = criteria.versions?.find((extensionIdentifierWithVersion) => $DA(extensionIdentifierWithVersion, extensionIdentifier))?.version;
        const includePreRelease = $Fg(criteria.includePreRelease) ? criteria.includePreRelease : !!criteria.includePreRelease.find((extensionIdentifierWithPreRelease) => $DA(extensionIdentifierWithPreRelease, extensionIdentifier))?.includePreRelease;
        const allTargetPlatforms = getAllTargetPlatforms(rawGalleryExtension);
        const rawGalleryExtensionVersions = $9W(rawGalleryExtension.versions, criteria.targetPlatform);
        if (criteria.compatible && $mA(allTargetPlatforms, criteria.targetPlatform)) {
          return null;
        }
        for (let index = 0; index < rawGalleryExtensionVersions.length; index++) {
          const rawGalleryExtensionVersion = rawGalleryExtensionVersions[index];
          if (version && rawGalleryExtensionVersion.version !== version) {
            continue;
          }
          if (await this.E(extensionIdentifier.id, rawGalleryExtensionVersion, rawGalleryExtension.publisher.displayName, includePreRelease ? "any" : "release", criteria.compatible, allTargetPlatforms, criteria.targetPlatform, criteria.productVersion)) {
            if (criteria.compatible && !this.D(extensionIdentifier, getEnabledApiProposals(rawGalleryExtensionVersion))) {
              continue;
            }
            return toExtension(rawGalleryExtension, rawGalleryExtensionVersion, allTargetPlatforms, queryContext);
          }
          if (version && rawGalleryExtensionVersion.version === version) {
            return null;
          }
        }
        if (version || criteria.compatible) {
          return null;
        }
        return toExtension(rawGalleryExtension, rawGalleryExtension.versions[0], allTargetPlatforms);
      }
      async H(query, token) {
        if (!this.isEnabled()) {
          throw new Error("No extension gallery service configured.");
        }
        query = query.withFlags(query.flags, Flags.ExcludeNonValidated).withFilter(FilterType.Target, "Microsoft.VisualStudio.Code").withFilter(FilterType.ExcludeWithFlags, flagsToString(Flags.Unpublished));
        const commonHeaders = await this.k;
        const data = JSON.stringify(query.raw);
        const headers = {
          ...commonHeaders,
          "Content-Type": "application/json",
          "Accept": "application/json;api-version=3.0-preview.1",
          "Accept-Encoding": "gzip",
          "Content-Length": String(data.length)
        };
        const stopWatch = new $te();
        let context, errorCode, total = 0;
        try {
          context = await this.n.request({
            type: "POST",
            url: this.g && query.criteria.some((c) => c.filterType === FilterType.SearchText) ? this.g : this.A("/extensionquery"),
            data,
            headers
          }, token);
          if (context.res.statusCode && context.res.statusCode >= 400 && context.res.statusCode < 500) {
            return { galleryExtensions: [], total };
          }
          const result = await $cv(context);
          if (result) {
            const r = result.results[0];
            const galleryExtensions = r.extensions;
            const resultCount = r.resultMetadata && r.resultMetadata.filter((m) => m.metadataType === "ResultCount")[0];
            total = resultCount && resultCount.metadataItems.filter((i) => i.name === "TotalCount")[0].count || 0;
            return {
              galleryExtensions,
              total,
              context: context.res.headers["activityid"] ? {
                [ACTIVITY_HEADER_NAME]: context.res.headers["activityid"]
              } : {}
            };
          }
          return { galleryExtensions: [], total };
        } catch (e) {
          if ($kb(e)) {
            errorCode = "Cancelled";
            throw e;
          } else {
            const errorMessage = $qb(e);
            errorCode = $7u(e) ? "Offline" : errorMessage.startsWith("XHR timeout") ? "Timeout" : "Failed";
            throw new $qA(errorMessage, errorCode);
          }
        } finally {
          this.u.publicLog2("galleryService:query", {
            ...query.telemetryData,
            requestBodySize: String(data.length),
            duration: stopWatch.elapsed(),
            success: !!context && $$u(context),
            responseBodySize: context?.res.headers["Content-Length"],
            statusCode: context ? String(context.res.statusCode) : void 0,
            errorCode,
            count: String(total)
          });
        }
      }
      async I(extensionId, token) {
        let errorCode;
        const stopWatch = new $te();
        try {
          const [publisher, name] = extensionId.split(".");
          if (!publisher || !name) {
            errorCode = "InvalidExtensionId";
            return void 0;
          }
          const uri = URI.parse($xf(this.j, { publisher, name }));
          const commonHeaders = await this.k;
          const headers = {
            ...commonHeaders,
            "Content-Type": "application/json",
            "Accept": "application/json;api-version=7.2-preview",
            "Accept-Encoding": "gzip"
          };
          const context = await this.n.request({
            type: "GET",
            url: uri.toString(true),
            headers,
            timeout: 1e4
            /*10s*/
          }, token);
          if (context.res.statusCode && context.res.statusCode !== 200) {
            errorCode = `GalleryServiceError:` + context.res.statusCode;
            this.o.warn("Error getting latest version of the extension", extensionId, context.res.statusCode);
            return void 0;
          }
          const result = await $cv(context);
          if (result) {
            return result;
          }
          errorCode = "NoData";
          this.o.warn("Error getting latest version of the extension", extensionId, errorCode);
        } catch (error) {
          if ($kb(error)) {
            errorCode = "Cancelled";
          } else {
            const errorMessage = $qb(error);
            errorCode = $7u(error) ? "Offline" : errorMessage.startsWith("XHR timeout") ? "Timeout" : "Failed";
          }
        } finally {
          this.u.publicLog2("galleryService:getLatest", { extension: extensionId, duration: stopWatch.elapsed(), errorCode });
        }
        return void 0;
      }
      async reportStatistic(publisher, name, version, type2) {
        if (!this.isEnabled()) {
          return void 0;
        }
        const url3 = $r ? this.A(`/itemName/${publisher}.${name}/version/${version}/statType/${type2 === "install" ? "1" : "3"}/vscodewebextension`) : this.A(`/publishers/${publisher}/extensions/${name}/${version}/stats?statType=${type2}`);
        const Accept = $r ? "api-version=6.1-preview.1" : "*/*;api-version=4.0-preview.1";
        const commonHeaders = await this.k;
        const headers = { ...commonHeaders, Accept };
        try {
          await this.n.request({
            type: "POST",
            url: url3,
            headers
          }, CancellationToken.None);
        } catch (error) {
        }
      }
      async download(extension, location2, operation) {
        this.o.trace("ExtensionGalleryService#download", extension.identifier.id);
        const data = $LA(extension);
        const startTime = (/* @__PURE__ */ new Date()).getTime();
        const operationParam = operation === 2 ? "install" : operation === 3 ? "update" : "";
        const downloadAsset = operationParam ? {
          uri: `${extension.assets.download.uri}${URI.parse(extension.assets.download.uri).query ? "&" : "?"}${operationParam}=true`,
          fallbackUri: `${extension.assets.download.fallbackUri}${URI.parse(extension.assets.download.fallbackUri).query ? "&" : "?"}${operationParam}=true`
        } : extension.assets.download;
        const headers = extension.queryContext?.[ACTIVITY_HEADER_NAME] ? { [ACTIVITY_HEADER_NAME]: extension.queryContext[ACTIVITY_HEADER_NAME] } : void 0;
        const context = await this.K(extension.identifier.id, downloadAsset, AssetType.VSIX, headers ? { headers } : void 0);
        try {
          await this.w.writeFile(location2, context.stream);
        } catch (error) {
          try {
            await this.w.del(location2);
          } catch (e) {
            this.o.warn(`Error while deleting the file ${location2.toString()}`, $qb(e));
          }
          throw new $qA(
            $qb(error),
            "DownloadFailedWriting"
            /* ExtensionGalleryErrorCode.DownloadFailedWriting */
          );
        }
        this.u.publicLog("galleryService:downloadVSIX", { ...data, duration: (/* @__PURE__ */ new Date()).getTime() - startTime });
      }
      async downloadSignatureArchive(extension, location2) {
        if (!extension.assets.signature) {
          throw new Error("No signature asset found");
        }
        this.o.trace("ExtensionGalleryService#downloadSignatureArchive", extension.identifier.id);
        const context = await this.K(extension.identifier.id, extension.assets.signature, AssetType.Signature);
        try {
          await this.w.writeFile(location2, context.stream);
        } catch (error) {
          try {
            await this.w.del(location2);
          } catch (e) {
            this.o.warn(`Error while deleting the file ${location2.toString()}`, $qb(e));
          }
          throw new $qA(
            $qb(error),
            "DownloadFailedWriting"
            /* ExtensionGalleryErrorCode.DownloadFailedWriting */
          );
        }
      }
      async getReadme(extension, token) {
        if (extension.assets.readme) {
          const context = await this.K(extension.identifier.id, extension.assets.readme, AssetType.Details, {}, token);
          const content = await $bv(context);
          return content || "";
        }
        return "";
      }
      async getManifest(extension, token) {
        if (extension.assets.manifest) {
          const context = await this.K(extension.identifier.id, extension.assets.manifest, AssetType.Manifest, {}, token);
          const text = await $bv(context);
          return text ? JSON.parse(text) : null;
        }
        return null;
      }
      async J(extension, rawExtensionVersion, token) {
        const manifestAsset = getVersionAsset(rawExtensionVersion, AssetType.Manifest);
        if (!manifestAsset) {
          throw new Error("Manifest was not found");
        }
        const headers = { "Accept-Encoding": "gzip" };
        const context = await this.K(extension, manifestAsset, AssetType.Manifest, { headers });
        return await $cv(context);
      }
      async getCoreTranslation(extension, languageId) {
        const asset = extension.assets.coreTranslations.filter((t) => t[0] === languageId.toUpperCase())[0];
        if (asset) {
          const context = await this.K(extension.identifier.id, asset[1], asset[0]);
          const text = await $bv(context);
          return text ? JSON.parse(text) : null;
        }
        return null;
      }
      async getChangelog(extension, token) {
        if (extension.assets.changelog) {
          const context = await this.K(extension.identifier.id, extension.assets.changelog, AssetType.Changelog, {}, token);
          const content = await $bv(context);
          return content || "";
        }
        return "";
      }
      async getAllCompatibleVersions(extensionIdentifier, includePreRelease, targetPlatform) {
        let query = new Query().withFlags(Flags.IncludeVersions, Flags.IncludeCategoryAndTags, Flags.IncludeFiles, Flags.IncludeVersionProperties).withPage(1, 1);
        if (extensionIdentifier.uuid) {
          query = query.withFilter(FilterType.ExtensionId, extensionIdentifier.uuid);
        } else {
          query = query.withFilter(FilterType.ExtensionName, extensionIdentifier.id);
        }
        const { galleryExtensions } = await this.H(query, CancellationToken.None);
        if (!galleryExtensions.length) {
          return [];
        }
        const allTargetPlatforms = getAllTargetPlatforms(galleryExtensions[0]);
        if ($mA(allTargetPlatforms, targetPlatform)) {
          return [];
        }
        const validVersions = [];
        await Promise.all(galleryExtensions[0].versions.map(async (version) => {
          try {
            if (await this.E(extensionIdentifier.id, version, galleryExtensions[0].publisher.displayName, includePreRelease ? "any" : "release", true, allTargetPlatforms, targetPlatform) && this.D(extensionIdentifier, getEnabledApiProposals(version))) {
              validVersions.push(version);
            }
          } catch (error) {
          }
        }));
        const result = [];
        const seen = /* @__PURE__ */ new Set();
        for (const version of $9W(validVersions, targetPlatform)) {
          if (!seen.has(version.version)) {
            seen.add(version.version);
            result.push({ version: version.version, date: version.lastUpdated, isPreReleaseVersion: isPreReleaseVersion(version) });
          }
        }
        return result;
      }
      async K(extension, asset, assetType, options2 = {}, token = CancellationToken.None) {
        const commonHeaders = await this.k;
        const baseOptions = { type: "GET" };
        const headers = { ...commonHeaders, ...options2.headers || {} };
        options2 = { ...options2, ...baseOptions, headers };
        const url3 = asset.uri;
        const fallbackUrl = asset.fallbackUri;
        const firstOptions = { ...options2, url: url3 };
        try {
          const context = await this.n.request(firstOptions, token);
          if (context.res.statusCode === 200) {
            return context;
          }
          const message = await $bv(context);
          throw new Error(`Expected 200, got back ${context.res.statusCode} instead.

${message}`);
        } catch (err) {
          if ($kb(err)) {
            throw err;
          }
          const message = $qb(err);
          this.u.publicLog2("galleryService:cdnFallback", { extension, assetType, message });
          const fallbackOptions = { ...options2, url: fallbackUrl };
          return this.n.request(fallbackOptions, token);
        }
      }
      async L(extension, rawExtensionVersion) {
        let engine = getEngine(rawExtensionVersion);
        if (!engine) {
          this.u.publicLog2("galleryService:engineFallback", { extension, version: rawExtensionVersion.version });
          const manifest = await this.J(extension, rawExtensionVersion, CancellationToken.None);
          if (!manifest) {
            throw new Error("Manifest was not found");
          }
          engine = manifest.engines.vscode;
        }
        return engine;
      }
      async getExtensionsControlManifest() {
        if (!this.isEnabled()) {
          throw new Error("No extension gallery service configured.");
        }
        if (!this.h) {
          return { malicious: [], deprecated: {}, search: [] };
        }
        const context = await this.n.request({ type: "GET", url: this.h }, CancellationToken.None);
        if (context.res.statusCode !== 200) {
          throw new Error("Could not get extensions report.");
        }
        const result = await $cv(context);
        const malicious = [];
        const deprecated = {};
        const search = [];
        const extensionsEnabledWithPreRelease = [];
        if (result) {
          for (const id2 of result.malicious) {
            malicious.push({ id: id2 });
          }
          if (result.migrateToPreRelease) {
            for (const [unsupportedPreReleaseExtensionId, preReleaseExtensionInfo] of Object.entries(result.migrateToPreRelease)) {
              if (!preReleaseExtensionInfo.engine || $1A(preReleaseExtensionInfo.engine, this.x.version, this.x.date)) {
                deprecated[unsupportedPreReleaseExtensionId.toLowerCase()] = {
                  disallowInstall: true,
                  extension: {
                    id: preReleaseExtensionInfo.id,
                    displayName: preReleaseExtensionInfo.displayName,
                    autoMigrate: { storage: !!preReleaseExtensionInfo.migrateStorage },
                    preRelease: true
                  }
                };
              }
            }
          }
          if (result.deprecated) {
            for (const [deprecatedExtensionId, deprecationInfo] of Object.entries(result.deprecated)) {
              if (deprecationInfo) {
                deprecated[deprecatedExtensionId.toLowerCase()] = $Fg(deprecationInfo) ? {} : deprecationInfo;
              }
            }
          }
          if (result.search) {
            for (const s of result.search) {
              search.push(s);
            }
          }
          if (Array.isArray(result.extensionsEnabledWithPreRelease)) {
            for (const id2 of result.extensionsEnabledWithPreRelease) {
              extensionsEnabledWithPreRelease.push(id2.toLowerCase());
            }
          }
        }
        return { malicious, deprecated, search, extensionsEnabledWithPreRelease };
      }
    };
    AbstractExtensionGalleryService = __decorate([
      __param(1, $9u),
      __param(2, $wn),
      __param(3, $Xk),
      __param(4, $zv),
      __param(5, $km),
      __param(6, $Vu),
      __param(7, $kl),
      __param(8, $xA)
    ], AbstractExtensionGalleryService);
    $0W = class $0W2 extends AbstractExtensionGalleryService {
      constructor(storageService, requestService, logService, environmentService, telemetryService, fileService, productService, configurationService, allowedExtensionsService) {
        super(storageService, requestService, logService, environmentService, telemetryService, fileService, productService, configurationService, allowedExtensionsService);
      }
    };
    $0W = __decorate([
      __param(0, $jv),
      __param(1, $9u),
      __param(2, $wn),
      __param(3, $Xk),
      __param(4, $zv),
      __param(5, $km),
      __param(6, $Vu),
      __param(7, $kl),
      __param(8, $xA)
    ], $0W);
    $$W = class $$W2 extends AbstractExtensionGalleryService {
      constructor(requestService, logService, environmentService, telemetryService, fileService, productService, configurationService, allowedExtensionsService) {
        super(void 0, requestService, logService, environmentService, telemetryService, fileService, productService, configurationService, allowedExtensionsService);
      }
    };
    $$W = __decorate([
      __param(0, $9u),
      __param(1, $wn),
      __param(2, $Xk),
      __param(3, $zv),
      __param(4, $km),
      __param(5, $Vu),
      __param(6, $kl),
      __param(7, $xA)
    ], $$W);
  }
});

// out-build/vs/base/node/zip.js
import { createWriteStream, promises as promises5 } from "fs";
function modeFromEntry(entry) {
  const attr = entry.externalFileAttributes >> 16 || 33188;
  return [
    448,
    56,
    7
    /* S_IRWXO */
  ].map((mask) => attr & mask).reduce(
    (a, b) => a + b,
    attr & 61440
    /* S_IFMT */
  );
}
function toExtractError(err) {
  if (err instanceof $kX) {
    return err;
  }
  let type2 = void 0;
  if (CORRUPT_ZIP_PATTERN.test(err.message)) {
    type2 = "CorruptZip";
  }
  return new $kX(type2, err);
}
function extractEntry(stream, fileName, mode, targetPath, options2, token) {
  const dirName = $qc(fileName);
  const targetDirName = $nc(targetPath, dirName);
  if (!targetDirName.startsWith(targetPath)) {
    return Promise.reject(new Error(localize(145, null, fileName)));
  }
  const targetFileName = $nc(targetPath, fileName);
  let istream;
  token.onCancellationRequested(() => {
    istream?.destroy();
  });
  return Promise.resolve(promises5.mkdir(targetDirName, { recursive: true })).then(() => new Promise((c, e) => {
    if (token.isCancellationRequested) {
      return;
    }
    try {
      istream = createWriteStream(targetFileName, { mode });
      istream.once("close", () => c());
      istream.once("error", e);
      stream.once("error", e);
      stream.pipe(istream);
    } catch (error) {
      e(error);
    }
  }));
}
function extractZip(zipfile, targetPath, options2, token) {
  let last = $Hh(() => Promise.resolve());
  let extractedEntriesCount = 0;
  const listener = token.onCancellationRequested(() => {
    last.cancel();
    zipfile.close();
  });
  return new Promise((c, e) => {
    const throttler = new $Qh();
    const readNextEntry = (token2) => {
      if (token2.isCancellationRequested) {
        return;
      }
      extractedEntriesCount++;
      zipfile.readEntry();
    };
    zipfile.once("error", e);
    zipfile.once("close", () => last.then(() => {
      if (token.isCancellationRequested || zipfile.entryCount === extractedEntriesCount) {
        c();
      } else {
        e(new $kX("Incomplete", new Error(localize(146, null, extractedEntriesCount, zipfile.entryCount))));
      }
    }, e));
    zipfile.readEntry();
    zipfile.on("entry", (entry) => {
      if (token.isCancellationRequested) {
        return;
      }
      if (!options2.sourcePathRegex.test(entry.fileName)) {
        readNextEntry(token);
        return;
      }
      const fileName = entry.fileName.replace(options2.sourcePathRegex, "");
      if (/\/$/.test(fileName)) {
        const targetFileName = $nc(targetPath, fileName);
        last = $Hh((token2) => promises5.mkdir(targetFileName, { recursive: true }).then(() => readNextEntry(token2)).then(void 0, e));
        return;
      }
      const stream = openZipStream(zipfile, entry);
      const mode = modeFromEntry(entry);
      last = $Hh((token2) => throttler.queue(() => stream.then((stream2) => extractEntry(stream2, fileName, mode, targetPath, options2, token2).then(() => readNextEntry(token2)))).then(null, e));
    });
  }).finally(() => listener.dispose());
}
async function openZip(zipFile, lazy = false) {
  const { open: open2 } = await import("yauzl");
  return new Promise((resolve4, reject) => {
    open2(zipFile, lazy ? { lazyEntries: true } : void 0, (error, zipfile) => {
      if (error) {
        reject(toExtractError(error));
      } else {
        resolve4($Kg(zipfile));
      }
    });
  });
}
function openZipStream(zipFile, entry) {
  return new Promise((resolve4, reject) => {
    zipFile.openReadStream(entry, (error, stream) => {
      if (error) {
        reject(toExtractError(error));
      } else {
        resolve4($Kg(stream));
      }
    });
  });
}
async function zip(zipPath, files) {
  const { ZipFile } = await import("yazl");
  return new Promise((c, e) => {
    const zip2 = new ZipFile();
    files.forEach((f) => {
      if (f.contents) {
        zip2.addBuffer(typeof f.contents === "string" ? Buffer.from(f.contents, "utf8") : f.contents, f.path);
      } else if (f.localPath) {
        zip2.addFile(f.localPath, f.path);
      }
    });
    zip2.end();
    const zipStream = createWriteStream(zipPath);
    zip2.outputStream.pipe(zipStream);
    zip2.outputStream.once("error", e);
    zipStream.once("error", e);
    zipStream.once("finish", () => c(zipPath));
  });
}
function $mX(zipPath, targetPath, options2 = {}, token) {
  const sourcePathRegex = new RegExp(options2.sourcePath ? `^${options2.sourcePath}` : "");
  let promise = openZip(zipPath, true);
  if (options2.overwrite) {
    promise = promise.then((zipfile) => Promises2.rm(targetPath).then(() => zipfile));
  }
  return promise.then((zipfile) => extractZip(zipfile, targetPath, { sourcePathRegex }, token));
}
function read2(zipPath, filePath) {
  return openZip(zipPath).then((zipfile) => {
    return new Promise((c, e) => {
      zipfile.on("entry", (entry) => {
        if (entry.fileName === filePath) {
          openZipStream(zipfile, entry).then((stream) => c(stream), (err) => e(err));
        }
      });
      zipfile.once("close", () => e(new Error(localize(147, null, filePath))));
    });
  });
}
function $nX(zipPath, filePath) {
  return read2(zipPath, filePath).then((stream) => {
    return new Promise((c, e) => {
      const buffers = [];
      stream.once("error", e);
      stream.on("data", (b) => buffers.push(b));
      stream.on("end", () => c(Buffer.concat(buffers)));
    });
  });
}
var $jX, CORRUPT_ZIP_PATTERN, $kX;
var init_zip = __esm({
  "out-build/vs/base/node/zip.js"() {
    "use strict";
    init_async();
    init_path();
    init_types();
    init_pfs();
    init_nls2();
    $jX = "end of central directory record signature not found";
    CORRUPT_ZIP_PATTERN = new RegExp($jX);
    $kX = class extends Error {
      constructor(type2, cause) {
        let message = cause.message;
        switch (type2) {
          case "CorruptZip":
            message = `Corrupt ZIP: ${message}`;
            break;
        }
        super(message);
        this.type = type2;
        this.cause = cause;
      }
    };
  }
});

// out-build/vs/platform/download/common/download.js
var $6W;
var init_download = __esm({
  "out-build/vs/platform/download/common/download.js"() {
    "use strict";
    init_instantiation();
    $6W = $Qk("downloadService");
  }
});

// out-build/vs/base/common/naturalLanguage/korean.js
var codeBuffer, HangulRangeStartCode, AsciiCode, AsciiCodeCombo, modernConsonants, modernVowels, modernFinalConsonants, compatibilityJamo;
var init_korean = __esm({
  "out-build/vs/base/common/naturalLanguage/korean.js"() {
    "use strict";
    codeBuffer = new Uint32Array(10);
    (function(HangulRangeStartCode2) {
      HangulRangeStartCode2[HangulRangeStartCode2["InitialConsonant"] = 4352] = "InitialConsonant";
      HangulRangeStartCode2[HangulRangeStartCode2["Vowel"] = 4449] = "Vowel";
      HangulRangeStartCode2[HangulRangeStartCode2["FinalConsonant"] = 4520] = "FinalConsonant";
      HangulRangeStartCode2[HangulRangeStartCode2["CompatibilityJamo"] = 12593] = "CompatibilityJamo";
    })(HangulRangeStartCode || (HangulRangeStartCode = {}));
    (function(AsciiCode2) {
      AsciiCode2[AsciiCode2["NUL"] = 0] = "NUL";
      AsciiCode2[AsciiCode2["A"] = 65] = "A";
      AsciiCode2[AsciiCode2["B"] = 66] = "B";
      AsciiCode2[AsciiCode2["C"] = 67] = "C";
      AsciiCode2[AsciiCode2["D"] = 68] = "D";
      AsciiCode2[AsciiCode2["E"] = 69] = "E";
      AsciiCode2[AsciiCode2["F"] = 70] = "F";
      AsciiCode2[AsciiCode2["G"] = 71] = "G";
      AsciiCode2[AsciiCode2["H"] = 72] = "H";
      AsciiCode2[AsciiCode2["I"] = 73] = "I";
      AsciiCode2[AsciiCode2["J"] = 74] = "J";
      AsciiCode2[AsciiCode2["K"] = 75] = "K";
      AsciiCode2[AsciiCode2["L"] = 76] = "L";
      AsciiCode2[AsciiCode2["M"] = 77] = "M";
      AsciiCode2[AsciiCode2["N"] = 78] = "N";
      AsciiCode2[AsciiCode2["O"] = 79] = "O";
      AsciiCode2[AsciiCode2["P"] = 80] = "P";
      AsciiCode2[AsciiCode2["Q"] = 81] = "Q";
      AsciiCode2[AsciiCode2["R"] = 82] = "R";
      AsciiCode2[AsciiCode2["S"] = 83] = "S";
      AsciiCode2[AsciiCode2["T"] = 84] = "T";
      AsciiCode2[AsciiCode2["U"] = 85] = "U";
      AsciiCode2[AsciiCode2["V"] = 86] = "V";
      AsciiCode2[AsciiCode2["W"] = 87] = "W";
      AsciiCode2[AsciiCode2["X"] = 88] = "X";
      AsciiCode2[AsciiCode2["Y"] = 89] = "Y";
      AsciiCode2[AsciiCode2["Z"] = 90] = "Z";
      AsciiCode2[AsciiCode2["a"] = 97] = "a";
      AsciiCode2[AsciiCode2["b"] = 98] = "b";
      AsciiCode2[AsciiCode2["c"] = 99] = "c";
      AsciiCode2[AsciiCode2["d"] = 100] = "d";
      AsciiCode2[AsciiCode2["e"] = 101] = "e";
      AsciiCode2[AsciiCode2["f"] = 102] = "f";
      AsciiCode2[AsciiCode2["g"] = 103] = "g";
      AsciiCode2[AsciiCode2["h"] = 104] = "h";
      AsciiCode2[AsciiCode2["i"] = 105] = "i";
      AsciiCode2[AsciiCode2["j"] = 106] = "j";
      AsciiCode2[AsciiCode2["k"] = 107] = "k";
      AsciiCode2[AsciiCode2["l"] = 108] = "l";
      AsciiCode2[AsciiCode2["m"] = 109] = "m";
      AsciiCode2[AsciiCode2["n"] = 110] = "n";
      AsciiCode2[AsciiCode2["o"] = 111] = "o";
      AsciiCode2[AsciiCode2["p"] = 112] = "p";
      AsciiCode2[AsciiCode2["q"] = 113] = "q";
      AsciiCode2[AsciiCode2["r"] = 114] = "r";
      AsciiCode2[AsciiCode2["s"] = 115] = "s";
      AsciiCode2[AsciiCode2["t"] = 116] = "t";
      AsciiCode2[AsciiCode2["u"] = 117] = "u";
      AsciiCode2[AsciiCode2["v"] = 118] = "v";
      AsciiCode2[AsciiCode2["w"] = 119] = "w";
      AsciiCode2[AsciiCode2["x"] = 120] = "x";
      AsciiCode2[AsciiCode2["y"] = 121] = "y";
      AsciiCode2[AsciiCode2["z"] = 122] = "z";
    })(AsciiCode || (AsciiCode = {}));
    (function(AsciiCodeCombo2) {
      AsciiCodeCombo2[AsciiCodeCombo2["fa"] = 24934] = "fa";
      AsciiCodeCombo2[AsciiCodeCombo2["fg"] = 26470] = "fg";
      AsciiCodeCombo2[AsciiCodeCombo2["fq"] = 29030] = "fq";
      AsciiCodeCombo2[AsciiCodeCombo2["fr"] = 29286] = "fr";
      AsciiCodeCombo2[AsciiCodeCombo2["ft"] = 29798] = "ft";
      AsciiCodeCombo2[AsciiCodeCombo2["fv"] = 30310] = "fv";
      AsciiCodeCombo2[AsciiCodeCombo2["fx"] = 30822] = "fx";
      AsciiCodeCombo2[AsciiCodeCombo2["hk"] = 27496] = "hk";
      AsciiCodeCombo2[AsciiCodeCombo2["hl"] = 27752] = "hl";
      AsciiCodeCombo2[AsciiCodeCombo2["ho"] = 28520] = "ho";
      AsciiCodeCombo2[AsciiCodeCombo2["ml"] = 27757] = "ml";
      AsciiCodeCombo2[AsciiCodeCombo2["nj"] = 27246] = "nj";
      AsciiCodeCombo2[AsciiCodeCombo2["nl"] = 27758] = "nl";
      AsciiCodeCombo2[AsciiCodeCombo2["np"] = 28782] = "np";
      AsciiCodeCombo2[AsciiCodeCombo2["qt"] = 29809] = "qt";
      AsciiCodeCombo2[AsciiCodeCombo2["rt"] = 29810] = "rt";
      AsciiCodeCombo2[AsciiCodeCombo2["sg"] = 26483] = "sg";
      AsciiCodeCombo2[AsciiCodeCombo2["sw"] = 30579] = "sw";
    })(AsciiCodeCombo || (AsciiCodeCombo = {}));
    modernConsonants = new Uint8Array([
      114,
      // ㄱ
      82,
      // ㄲ
      115,
      // ㄴ
      101,
      // ㄷ
      69,
      // ㄸ
      102,
      // ㄹ
      97,
      // ㅁ
      113,
      // ㅂ
      81,
      // ㅃ
      116,
      // ㅅ
      84,
      // ㅆ
      100,
      // ㅇ
      119,
      // ㅈ
      87,
      // ㅉ
      99,
      // ㅊ
      122,
      // ㅋ
      120,
      // ㅌ
      118,
      // ㅍ
      103
      // ㅎ
    ]);
    modernVowels = new Uint16Array([
      107,
      //  -> ㅏ
      111,
      //  -> ㅐ
      105,
      //  -> ㅑ
      79,
      //  -> ㅒ
      106,
      //  -> ㅓ
      112,
      //  -> ㅔ
      117,
      //  -> ㅕ
      80,
      //  -> ㅖ
      104,
      //  -> ㅗ
      27496,
      //  -> ㅘ
      28520,
      //  -> ㅙ
      27752,
      //  -> ㅚ
      121,
      //  -> ㅛ
      110,
      //  -> ㅜ
      27246,
      //  -> ㅝ
      28782,
      //  -> ㅞ
      27758,
      //  -> ㅟ
      98,
      //  -> ㅠ
      109,
      //  -> ㅡ
      27757,
      //  -> ㅢ
      108
      //  -> ㅣ
    ]);
    modernFinalConsonants = 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
      // ㅎ
    ]);
    compatibilityJamo = 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
      // ㅣ
      // HF: Hangul Filler (everything after this is archaic)
      // ㅥ
      // ㅦ
      // ㅧ
      // ㅨ
      // ㅩ
      // ㅪ
      // ㅫ
      // ㅬ
      // ㅮ
      // ㅯ
      // ㅰ
      // ㅱ
      // ㅲ
      // ㅳ
      // ㅴ
      // ㅵ
      // ㅶ
      // ㅷ
      // ㅸ
      // ㅹ
      // ㅺ
      // ㅻ
      // ㅼ
      // ㅽ
      // ㅾ
      // ㅿ
      // ㆀ
      // ㆁ
      // ㆂ
      // ㆃ
      // ㆄ
      // ㆅ
      // ㆆ
      // ㆇ
      // ㆈ
      // ㆉ
      // ㆊ
      // ㆋ
      // ㆌ
      // ㆍ
      // ㆎ
    ]);
  }
});

// out-build/vs/base/common/filters.js
function or(...filter) {
  return function(word, wordToMatchAgainst) {
    for (let i = 0, len = filter.length; i < len; i++) {
      const match = filter[i](word, wordToMatchAgainst);
      if (match) {
        return match;
      }
    }
    return null;
  };
}
function _matchesPrefix(ignoreCase, word, wordToMatchAgainst) {
  if (!wordToMatchAgainst || wordToMatchAgainst.length < word.length) {
    return null;
  }
  let matches;
  if (ignoreCase) {
    matches = $2f(wordToMatchAgainst, word);
  } else {
    matches = wordToMatchAgainst.indexOf(word) === 0;
  }
  if (!matches) {
    return null;
  }
  return word.length > 0 ? [{ start: 0, end: word.length }] : [];
}
function $Ml(word, wordToMatchAgainst) {
  const index = wordToMatchAgainst.toLowerCase().indexOf(word.toLowerCase());
  if (index === -1) {
    return null;
  }
  return [{ start: index, end: index + word.length }];
}
function $Nl(word, wordToMatchAgainst) {
  return _matchesSubString(word.toLowerCase(), wordToMatchAgainst.toLowerCase(), 0, 0);
}
function _matchesSubString(word, wordToMatchAgainst, i, j) {
  if (i === word.length) {
    return [];
  } else if (j === wordToMatchAgainst.length) {
    return null;
  } else {
    if (word[i] === wordToMatchAgainst[j]) {
      let result = null;
      if (result = _matchesSubString(word, wordToMatchAgainst, i + 1, j + 1)) {
        return join3({ start: j, end: j + 1 }, result);
      }
      return null;
    }
    return _matchesSubString(word, wordToMatchAgainst, i, j + 1);
  }
}
function isLower(code) {
  return 97 <= code && code <= 122;
}
function $Ol(code) {
  return 65 <= code && code <= 90;
}
function isNumber(code) {
  return 48 <= code && code <= 57;
}
function isWhitespace2(code) {
  return code === 32 || code === 9 || code === 10 || code === 13;
}
function isAlphanumeric(code) {
  return isLower(code) || $Ol(code) || isNumber(code);
}
function join3(head, tail) {
  if (tail.length === 0) {
    tail = [head];
  } else if (head.end === tail[0].start) {
    tail[0].start = head.start;
  } else {
    tail.unshift(head);
  }
  return tail;
}
function nextAnchor(camelCaseWord, start) {
  for (let i = start; i < camelCaseWord.length; i++) {
    const c = camelCaseWord.charCodeAt(i);
    if ($Ol(c) || isNumber(c) || i > 0 && !isAlphanumeric(camelCaseWord.charCodeAt(i - 1))) {
      return i;
    }
  }
  return camelCaseWord.length;
}
function _matchesCamelCase(word, camelCaseWord, i, j) {
  if (i === word.length) {
    return [];
  } else if (j === camelCaseWord.length) {
    return null;
  } else if (word[i] !== camelCaseWord[j].toLowerCase()) {
    return null;
  } else {
    let result = null;
    let nextUpperIndex = j + 1;
    result = _matchesCamelCase(word, camelCaseWord, i + 1, j + 1);
    while (!result && (nextUpperIndex = nextAnchor(camelCaseWord, nextUpperIndex)) < camelCaseWord.length) {
      result = _matchesCamelCase(word, camelCaseWord, i + 1, nextUpperIndex);
      nextUpperIndex++;
    }
    return result === null ? null : join3({ start: j, end: j + 1 }, result);
  }
}
function analyzeCamelCaseWord(word) {
  let upper = 0, lower = 0, alpha = 0, numeric = 0, code = 0;
  for (let i = 0; i < word.length; i++) {
    code = word.charCodeAt(i);
    if ($Ol(code)) {
      upper++;
    }
    if (isLower(code)) {
      lower++;
    }
    if (isAlphanumeric(code)) {
      alpha++;
    }
    if (isNumber(code)) {
      numeric++;
    }
  }
  const upperPercent = upper / word.length;
  const lowerPercent = lower / word.length;
  const alphaPercent = alpha / word.length;
  const numericPercent = numeric / word.length;
  return { upperPercent, lowerPercent, alphaPercent, numericPercent };
}
function isUpperCaseWord(analysis) {
  const { upperPercent, lowerPercent } = analysis;
  return lowerPercent === 0 && upperPercent > 0.6;
}
function isCamelCaseWord(analysis) {
  const { upperPercent, lowerPercent, alphaPercent, numericPercent } = analysis;
  return lowerPercent > 0.2 && upperPercent < 0.8 && alphaPercent > 0.6 && numericPercent < 0.2;
}
function isCamelCasePattern(word) {
  let upper = 0, lower = 0, code = 0, whitespace = 0;
  for (let i = 0; i < word.length; i++) {
    code = word.charCodeAt(i);
    if ($Ol(code)) {
      upper++;
    }
    if (isLower(code)) {
      lower++;
    }
    if (isWhitespace2(code)) {
      whitespace++;
    }
  }
  if ((upper === 0 || lower === 0) && whitespace === 0) {
    return word.length <= 30;
  } else {
    return upper <= 5;
  }
}
function $Pl(word, camelCaseWord) {
  if (!camelCaseWord) {
    return null;
  }
  camelCaseWord = camelCaseWord.trim();
  if (camelCaseWord.length === 0) {
    return null;
  }
  if (!isCamelCasePattern(word)) {
    return null;
  }
  if (camelCaseWord.length > 60) {
    camelCaseWord = camelCaseWord.substring(0, 60);
  }
  const analysis = analyzeCamelCaseWord(camelCaseWord);
  if (!isCamelCaseWord(analysis)) {
    if (!isUpperCaseWord(analysis)) {
      return null;
    }
    camelCaseWord = camelCaseWord.toLowerCase();
  }
  let result = null;
  let i = 0;
  word = word.toLowerCase();
  while (i < camelCaseWord.length && (result = _matchesCamelCase(word, camelCaseWord, 0, i)) === null) {
    i = nextAnchor(camelCaseWord, i + 1);
  }
  return result;
}
function initTable() {
  const table = [];
  const row = [];
  for (let i = 0; i <= _maxLen; i++) {
    row[i] = 0;
  }
  for (let i = 0; i <= _maxLen; i++) {
    table.push(row.slice(0));
  }
  return table;
}
function initArr(maxLen) {
  const row = [];
  for (let i = 0; i <= maxLen; i++) {
    row[i] = 0;
  }
  return row;
}
var $Kl, $Ll, wordSeparators, fuzzyContiguousFilter, fuzzySeparateFilter, fuzzyRegExpCache, _maxLen, _minWordMatchPos, _maxWordMatchPos, _diag, _table, _arrows, Arrow, FuzzyScore, $Wl;
var init_filters = __esm({
  "out-build/vs/base/common/filters.js"() {
    "use strict";
    init_map();
    init_korean();
    init_strings();
    $Kl = _matchesPrefix.bind(void 0, false);
    $Ll = _matchesPrefix.bind(void 0, true);
    wordSeparators = /* @__PURE__ */ new Set();
    "()[]{}<>`'\"-/;:,.?!".split("").forEach((s) => wordSeparators.add(s.charCodeAt(0)));
    fuzzyContiguousFilter = or($Ll, $Pl, $Ml);
    fuzzySeparateFilter = or($Ll, $Pl, $Nl);
    fuzzyRegExpCache = new $Hc(1e4);
    _maxLen = 128;
    _minWordMatchPos = initArr(2 * _maxLen);
    _maxWordMatchPos = initArr(2 * _maxLen);
    _diag = initTable();
    _table = initTable();
    _arrows = initTable();
    (function(Arrow2) {
      Arrow2[Arrow2["Diag"] = 1] = "Diag";
      Arrow2[Arrow2["Left"] = 2] = "Left";
      Arrow2[Arrow2["LeftLeft"] = 3] = "LeftLeft";
    })(Arrow || (Arrow = {}));
    (function(FuzzyScore2) {
      FuzzyScore2.Default = [-100, 0];
      function isDefault(score) {
        return !score || score.length === 2 && score[0] === -100 && score[1] === 0;
      }
      FuzzyScore2.isDefault = isDefault;
    })(FuzzyScore || (FuzzyScore = {}));
    $Wl = class {
      static {
        this.default = { boostFullMatch: true, firstMatchCanBeWeak: false };
      }
      constructor(firstMatchCanBeWeak, boostFullMatch) {
        this.firstMatchCanBeWeak = firstMatchCanBeWeak;
        this.boostFullMatch = boostFullMatch;
      }
    };
  }
});

// out-build/vs/base/common/codiconsUtil.js
function $1l(id2, fontCharacter) {
  if ($zg(fontCharacter)) {
    const val = _codiconFontCharacters[fontCharacter];
    if (val === void 0) {
      throw new Error(`${id2} references an unknown codicon: ${fontCharacter}`);
    }
    fontCharacter = val;
  }
  _codiconFontCharacters[id2] = fontCharacter;
  return { id: id2 };
}
var _codiconFontCharacters;
var init_codiconsUtil = __esm({
  "out-build/vs/base/common/codiconsUtil.js"() {
    "use strict";
    init_types();
    _codiconFontCharacters = /* @__PURE__ */ Object.create(null);
  }
});

// out-build/vs/base/common/codiconsLibrary.js
var $3l;
var init_codiconsLibrary = __esm({
  "out-build/vs/base/common/codiconsLibrary.js"() {
    "use strict";
    init_codiconsUtil();
    $3l = {
      add: $1l("add", 6e4),
      plus: $1l("plus", 6e4),
      gistNew: $1l("gist-new", 6e4),
      repoCreate: $1l("repo-create", 6e4),
      lightbulb: $1l("lightbulb", 60001),
      lightBulb: $1l("light-bulb", 60001),
      repo: $1l("repo", 60002),
      repoDelete: $1l("repo-delete", 60002),
      gistFork: $1l("gist-fork", 60003),
      repoForked: $1l("repo-forked", 60003),
      gitPullRequest: $1l("git-pull-request", 60004),
      gitPullRequestAbandoned: $1l("git-pull-request-abandoned", 60004),
      recordKeys: $1l("record-keys", 60005),
      keyboard: $1l("keyboard", 60005),
      tag: $1l("tag", 60006),
      gitPullRequestLabel: $1l("git-pull-request-label", 60006),
      tagAdd: $1l("tag-add", 60006),
      tagRemove: $1l("tag-remove", 60006),
      person: $1l("person", 60007),
      personFollow: $1l("person-follow", 60007),
      personOutline: $1l("person-outline", 60007),
      personFilled: $1l("person-filled", 60007),
      gitBranch: $1l("git-branch", 60008),
      gitBranchCreate: $1l("git-branch-create", 60008),
      gitBranchDelete: $1l("git-branch-delete", 60008),
      sourceControl: $1l("source-control", 60008),
      mirror: $1l("mirror", 60009),
      mirrorPublic: $1l("mirror-public", 60009),
      star: $1l("star", 60010),
      starAdd: $1l("star-add", 60010),
      starDelete: $1l("star-delete", 60010),
      starEmpty: $1l("star-empty", 60010),
      comment: $1l("comment", 60011),
      commentAdd: $1l("comment-add", 60011),
      alert: $1l("alert", 60012),
      warning: $1l("warning", 60012),
      search: $1l("search", 60013),
      searchSave: $1l("search-save", 60013),
      logOut: $1l("log-out", 60014),
      signOut: $1l("sign-out", 60014),
      logIn: $1l("log-in", 60015),
      signIn: $1l("sign-in", 60015),
      eye: $1l("eye", 60016),
      eyeUnwatch: $1l("eye-unwatch", 60016),
      eyeWatch: $1l("eye-watch", 60016),
      circleFilled: $1l("circle-filled", 60017),
      primitiveDot: $1l("primitive-dot", 60017),
      closeDirty: $1l("close-dirty", 60017),
      debugBreakpoint: $1l("debug-breakpoint", 60017),
      debugBreakpointDisabled: $1l("debug-breakpoint-disabled", 60017),
      debugHint: $1l("debug-hint", 60017),
      terminalDecorationSuccess: $1l("terminal-decoration-success", 60017),
      primitiveSquare: $1l("primitive-square", 60018),
      edit: $1l("edit", 60019),
      pencil: $1l("pencil", 60019),
      info: $1l("info", 60020),
      issueOpened: $1l("issue-opened", 60020),
      gistPrivate: $1l("gist-private", 60021),
      gitForkPrivate: $1l("git-fork-private", 60021),
      lock: $1l("lock", 60021),
      mirrorPrivate: $1l("mirror-private", 60021),
      close: $1l("close", 60022),
      removeClose: $1l("remove-close", 60022),
      x: $1l("x", 60022),
      repoSync: $1l("repo-sync", 60023),
      sync: $1l("sync", 60023),
      clone: $1l("clone", 60024),
      desktopDownload: $1l("desktop-download", 60024),
      beaker: $1l("beaker", 60025),
      microscope: $1l("microscope", 60025),
      vm: $1l("vm", 60026),
      deviceDesktop: $1l("device-desktop", 60026),
      file: $1l("file", 60027),
      fileText: $1l("file-text", 60027),
      more: $1l("more", 60028),
      ellipsis: $1l("ellipsis", 60028),
      kebabHorizontal: $1l("kebab-horizontal", 60028),
      mailReply: $1l("mail-reply", 60029),
      reply: $1l("reply", 60029),
      organization: $1l("organization", 60030),
      organizationFilled: $1l("organization-filled", 60030),
      organizationOutline: $1l("organization-outline", 60030),
      newFile: $1l("new-file", 60031),
      fileAdd: $1l("file-add", 60031),
      newFolder: $1l("new-folder", 60032),
      fileDirectoryCreate: $1l("file-directory-create", 60032),
      trash: $1l("trash", 60033),
      trashcan: $1l("trashcan", 60033),
      history: $1l("history", 60034),
      clock: $1l("clock", 60034),
      folder: $1l("folder", 60035),
      fileDirectory: $1l("file-directory", 60035),
      symbolFolder: $1l("symbol-folder", 60035),
      logoGithub: $1l("logo-github", 60036),
      markGithub: $1l("mark-github", 60036),
      github: $1l("github", 60036),
      terminal: $1l("terminal", 60037),
      console: $1l("console", 60037),
      repl: $1l("repl", 60037),
      zap: $1l("zap", 60038),
      symbolEvent: $1l("symbol-event", 60038),
      error: $1l("error", 60039),
      stop: $1l("stop", 60039),
      variable: $1l("variable", 60040),
      symbolVariable: $1l("symbol-variable", 60040),
      array: $1l("array", 60042),
      symbolArray: $1l("symbol-array", 60042),
      symbolModule: $1l("symbol-module", 60043),
      symbolPackage: $1l("symbol-package", 60043),
      symbolNamespace: $1l("symbol-namespace", 60043),
      symbolObject: $1l("symbol-object", 60043),
      symbolMethod: $1l("symbol-method", 60044),
      symbolFunction: $1l("symbol-function", 60044),
      symbolConstructor: $1l("symbol-constructor", 60044),
      symbolBoolean: $1l("symbol-boolean", 60047),
      symbolNull: $1l("symbol-null", 60047),
      symbolNumeric: $1l("symbol-numeric", 60048),
      symbolNumber: $1l("symbol-number", 60048),
      symbolStructure: $1l("symbol-structure", 60049),
      symbolStruct: $1l("symbol-struct", 60049),
      symbolParameter: $1l("symbol-parameter", 60050),
      symbolTypeParameter: $1l("symbol-type-parameter", 60050),
      symbolKey: $1l("symbol-key", 60051),
      symbolText: $1l("symbol-text", 60051),
      symbolReference: $1l("symbol-reference", 60052),
      goToFile: $1l("go-to-file", 60052),
      symbolEnum: $1l("symbol-enum", 60053),
      symbolValue: $1l("symbol-value", 60053),
      symbolRuler: $1l("symbol-ruler", 60054),
      symbolUnit: $1l("symbol-unit", 60054),
      activateBreakpoints: $1l("activate-breakpoints", 60055),
      archive: $1l("archive", 60056),
      arrowBoth: $1l("arrow-both", 60057),
      arrowDown: $1l("arrow-down", 60058),
      arrowLeft: $1l("arrow-left", 60059),
      arrowRight: $1l("arrow-right", 60060),
      arrowSmallDown: $1l("arrow-small-down", 60061),
      arrowSmallLeft: $1l("arrow-small-left", 60062),
      arrowSmallRight: $1l("arrow-small-right", 60063),
      arrowSmallUp: $1l("arrow-small-up", 60064),
      arrowUp: $1l("arrow-up", 60065),
      bell: $1l("bell", 60066),
      bold: $1l("bold", 60067),
      book: $1l("book", 60068),
      bookmark: $1l("bookmark", 60069),
      debugBreakpointConditionalUnverified: $1l("debug-breakpoint-conditional-unverified", 60070),
      debugBreakpointConditional: $1l("debug-breakpoint-conditional", 60071),
      debugBreakpointConditionalDisabled: $1l("debug-breakpoint-conditional-disabled", 60071),
      debugBreakpointDataUnverified: $1l("debug-breakpoint-data-unverified", 60072),
      debugBreakpointData: $1l("debug-breakpoint-data", 60073),
      debugBreakpointDataDisabled: $1l("debug-breakpoint-data-disabled", 60073),
      debugBreakpointLogUnverified: $1l("debug-breakpoint-log-unverified", 60074),
      debugBreakpointLog: $1l("debug-breakpoint-log", 60075),
      debugBreakpointLogDisabled: $1l("debug-breakpoint-log-disabled", 60075),
      briefcase: $1l("briefcase", 60076),
      broadcast: $1l("broadcast", 60077),
      browser: $1l("browser", 60078),
      bug: $1l("bug", 60079),
      calendar: $1l("calendar", 60080),
      caseSensitive: $1l("case-sensitive", 60081),
      check: $1l("check", 60082),
      checklist: $1l("checklist", 60083),
      chevronDown: $1l("chevron-down", 60084),
      chevronLeft: $1l("chevron-left", 60085),
      chevronRight: $1l("chevron-right", 60086),
      chevronUp: $1l("chevron-up", 60087),
      chromeClose: $1l("chrome-close", 60088),
      chromeMaximize: $1l("chrome-maximize", 60089),
      chromeMinimize: $1l("chrome-minimize", 60090),
      chromeRestore: $1l("chrome-restore", 60091),
      circleOutline: $1l("circle-outline", 60092),
      circle: $1l("circle", 60092),
      debugBreakpointUnverified: $1l("debug-breakpoint-unverified", 60092),
      terminalDecorationIncomplete: $1l("terminal-decoration-incomplete", 60092),
      circleSlash: $1l("circle-slash", 60093),
      circuitBoard: $1l("circuit-board", 60094),
      clearAll: $1l("clear-all", 60095),
      clippy: $1l("clippy", 60096),
      closeAll: $1l("close-all", 60097),
      cloudDownload: $1l("cloud-download", 60098),
      cloudUpload: $1l("cloud-upload", 60099),
      code: $1l("code", 60100),
      collapseAll: $1l("collapse-all", 60101),
      colorMode: $1l("color-mode", 60102),
      commentDiscussion: $1l("comment-discussion", 60103),
      creditCard: $1l("credit-card", 60105),
      dash: $1l("dash", 60108),
      dashboard: $1l("dashboard", 60109),
      database: $1l("database", 60110),
      debugContinue: $1l("debug-continue", 60111),
      debugDisconnect: $1l("debug-disconnect", 60112),
      debugPause: $1l("debug-pause", 60113),
      debugRestart: $1l("debug-restart", 60114),
      debugStart: $1l("debug-start", 60115),
      debugStepInto: $1l("debug-step-into", 60116),
      debugStepOut: $1l("debug-step-out", 60117),
      debugStepOver: $1l("debug-step-over", 60118),
      debugStop: $1l("debug-stop", 60119),
      debug: $1l("debug", 60120),
      deviceCameraVideo: $1l("device-camera-video", 60121),
      deviceCamera: $1l("device-camera", 60122),
      deviceMobile: $1l("device-mobile", 60123),
      diffAdded: $1l("diff-added", 60124),
      diffIgnored: $1l("diff-ignored", 60125),
      diffModified: $1l("diff-modified", 60126),
      diffRemoved: $1l("diff-removed", 60127),
      diffRenamed: $1l("diff-renamed", 60128),
      diff: $1l("diff", 60129),
      diffSidebyside: $1l("diff-sidebyside", 60129),
      discard: $1l("discard", 60130),
      editorLayout: $1l("editor-layout", 60131),
      emptyWindow: $1l("empty-window", 60132),
      exclude: $1l("exclude", 60133),
      extensions: $1l("extensions", 60134),
      eyeClosed: $1l("eye-closed", 60135),
      fileBinary: $1l("file-binary", 60136),
      fileCode: $1l("file-code", 60137),
      fileMedia: $1l("file-media", 60138),
      filePdf: $1l("file-pdf", 60139),
      fileSubmodule: $1l("file-submodule", 60140),
      fileSymlinkDirectory: $1l("file-symlink-directory", 60141),
      fileSymlinkFile: $1l("file-symlink-file", 60142),
      fileZip: $1l("file-zip", 60143),
      files: $1l("files", 60144),
      filter: $1l("filter", 60145),
      flame: $1l("flame", 60146),
      foldDown: $1l("fold-down", 60147),
      foldUp: $1l("fold-up", 60148),
      fold: $1l("fold", 60149),
      folderActive: $1l("folder-active", 60150),
      folderOpened: $1l("folder-opened", 60151),
      gear: $1l("gear", 60152),
      gift: $1l("gift", 60153),
      gistSecret: $1l("gist-secret", 60154),
      gist: $1l("gist", 60155),
      gitCommit: $1l("git-commit", 60156),
      gitCompare: $1l("git-compare", 60157),
      compareChanges: $1l("compare-changes", 60157),
      gitMerge: $1l("git-merge", 60158),
      githubAction: $1l("github-action", 60159),
      githubAlt: $1l("github-alt", 60160),
      globe: $1l("globe", 60161),
      grabber: $1l("grabber", 60162),
      graph: $1l("graph", 60163),
      gripper: $1l("gripper", 60164),
      heart: $1l("heart", 60165),
      home: $1l("home", 60166),
      horizontalRule: $1l("horizontal-rule", 60167),
      hubot: $1l("hubot", 60168),
      inbox: $1l("inbox", 60169),
      issueReopened: $1l("issue-reopened", 60171),
      issues: $1l("issues", 60172),
      italic: $1l("italic", 60173),
      jersey: $1l("jersey", 60174),
      json: $1l("json", 60175),
      kebabVertical: $1l("kebab-vertical", 60176),
      key: $1l("key", 60177),
      law: $1l("law", 60178),
      lightbulbAutofix: $1l("lightbulb-autofix", 60179),
      linkExternal: $1l("link-external", 60180),
      link: $1l("link", 60181),
      listOrdered: $1l("list-ordered", 60182),
      listUnordered: $1l("list-unordered", 60183),
      liveShare: $1l("live-share", 60184),
      loading: $1l("loading", 60185),
      location: $1l("location", 60186),
      mailRead: $1l("mail-read", 60187),
      mail: $1l("mail", 60188),
      markdown: $1l("markdown", 60189),
      megaphone: $1l("megaphone", 60190),
      mention: $1l("mention", 60191),
      milestone: $1l("milestone", 60192),
      gitPullRequestMilestone: $1l("git-pull-request-milestone", 60192),
      mortarBoard: $1l("mortar-board", 60193),
      move: $1l("move", 60194),
      multipleWindows: $1l("multiple-windows", 60195),
      mute: $1l("mute", 60196),
      noNewline: $1l("no-newline", 60197),
      note: $1l("note", 60198),
      octoface: $1l("octoface", 60199),
      openPreview: $1l("open-preview", 60200),
      package: $1l("package", 60201),
      paintcan: $1l("paintcan", 60202),
      pin: $1l("pin", 60203),
      play: $1l("play", 60204),
      run: $1l("run", 60204),
      plug: $1l("plug", 60205),
      preserveCase: $1l("preserve-case", 60206),
      preview: $1l("preview", 60207),
      project: $1l("project", 60208),
      pulse: $1l("pulse", 60209),
      question: $1l("question", 60210),
      quote: $1l("quote", 60211),
      radioTower: $1l("radio-tower", 60212),
      reactions: $1l("reactions", 60213),
      references: $1l("references", 60214),
      refresh: $1l("refresh", 60215),
      regex: $1l("regex", 60216),
      remoteExplorer: $1l("remote-explorer", 60217),
      remote: $1l("remote", 60218),
      remove: $1l("remove", 60219),
      replaceAll: $1l("replace-all", 60220),
      replace: $1l("replace", 60221),
      repoClone: $1l("repo-clone", 60222),
      repoForcePush: $1l("repo-force-push", 60223),
      repoPull: $1l("repo-pull", 60224),
      repoPush: $1l("repo-push", 60225),
      report: $1l("report", 60226),
      requestChanges: $1l("request-changes", 60227),
      rocket: $1l("rocket", 60228),
      rootFolderOpened: $1l("root-folder-opened", 60229),
      rootFolder: $1l("root-folder", 60230),
      rss: $1l("rss", 60231),
      ruby: $1l("ruby", 60232),
      saveAll: $1l("save-all", 60233),
      saveAs: $1l("save-as", 60234),
      save: $1l("save", 60235),
      screenFull: $1l("screen-full", 60236),
      screenNormal: $1l("screen-normal", 60237),
      searchStop: $1l("search-stop", 60238),
      server: $1l("server", 60240),
      settingsGear: $1l("settings-gear", 60241),
      settings: $1l("settings", 60242),
      shield: $1l("shield", 60243),
      smiley: $1l("smiley", 60244),
      sortPrecedence: $1l("sort-precedence", 60245),
      splitHorizontal: $1l("split-horizontal", 60246),
      splitVertical: $1l("split-vertical", 60247),
      squirrel: $1l("squirrel", 60248),
      starFull: $1l("star-full", 60249),
      starHalf: $1l("star-half", 60250),
      symbolClass: $1l("symbol-class", 60251),
      symbolColor: $1l("symbol-color", 60252),
      symbolConstant: $1l("symbol-constant", 60253),
      symbolEnumMember: $1l("symbol-enum-member", 60254),
      symbolField: $1l("symbol-field", 60255),
      symbolFile: $1l("symbol-file", 60256),
      symbolInterface: $1l("symbol-interface", 60257),
      symbolKeyword: $1l("symbol-keyword", 60258),
      symbolMisc: $1l("symbol-misc", 60259),
      symbolOperator: $1l("symbol-operator", 60260),
      symbolProperty: $1l("symbol-property", 60261),
      wrench: $1l("wrench", 60261),
      wrenchSubaction: $1l("wrench-subaction", 60261),
      symbolSnippet: $1l("symbol-snippet", 60262),
      tasklist: $1l("tasklist", 60263),
      telescope: $1l("telescope", 60264),
      textSize: $1l("text-size", 60265),
      threeBars: $1l("three-bars", 60266),
      thumbsdown: $1l("thumbsdown", 60267),
      thumbsup: $1l("thumbsup", 60268),
      tools: $1l("tools", 60269),
      triangleDown: $1l("triangle-down", 60270),
      triangleLeft: $1l("triangle-left", 60271),
      triangleRight: $1l("triangle-right", 60272),
      triangleUp: $1l("triangle-up", 60273),
      twitter: $1l("twitter", 60274),
      unfold: $1l("unfold", 60275),
      unlock: $1l("unlock", 60276),
      unmute: $1l("unmute", 60277),
      unverified: $1l("unverified", 60278),
      verified: $1l("verified", 60279),
      versions: $1l("versions", 60280),
      vmActive: $1l("vm-active", 60281),
      vmOutline: $1l("vm-outline", 60282),
      vmRunning: $1l("vm-running", 60283),
      watch: $1l("watch", 60284),
      whitespace: $1l("whitespace", 60285),
      wholeWord: $1l("whole-word", 60286),
      window: $1l("window", 60287),
      wordWrap: $1l("word-wrap", 60288),
      zoomIn: $1l("zoom-in", 60289),
      zoomOut: $1l("zoom-out", 60290),
      listFilter: $1l("list-filter", 60291),
      listFlat: $1l("list-flat", 60292),
      listSelection: $1l("list-selection", 60293),
      selection: $1l("selection", 60293),
      listTree: $1l("list-tree", 60294),
      debugBreakpointFunctionUnverified: $1l("debug-breakpoint-function-unverified", 60295),
      debugBreakpointFunction: $1l("debug-breakpoint-function", 60296),
      debugBreakpointFunctionDisabled: $1l("debug-breakpoint-function-disabled", 60296),
      debugStackframeActive: $1l("debug-stackframe-active", 60297),
      circleSmallFilled: $1l("circle-small-filled", 60298),
      debugStackframeDot: $1l("debug-stackframe-dot", 60298),
      terminalDecorationMark: $1l("terminal-decoration-mark", 60298),
      debugStackframe: $1l("debug-stackframe", 60299),
      debugStackframeFocused: $1l("debug-stackframe-focused", 60299),
      debugBreakpointUnsupported: $1l("debug-breakpoint-unsupported", 60300),
      symbolString: $1l("symbol-string", 60301),
      debugReverseContinue: $1l("debug-reverse-continue", 60302),
      debugStepBack: $1l("debug-step-back", 60303),
      debugRestartFrame: $1l("debug-restart-frame", 60304),
      debugAlt: $1l("debug-alt", 60305),
      callIncoming: $1l("call-incoming", 60306),
      callOutgoing: $1l("call-outgoing", 60307),
      menu: $1l("menu", 60308),
      expandAll: $1l("expand-all", 60309),
      feedback: $1l("feedback", 60310),
      gitPullRequestReviewer: $1l("git-pull-request-reviewer", 60310),
      groupByRefType: $1l("group-by-ref-type", 60311),
      ungroupByRefType: $1l("ungroup-by-ref-type", 60312),
      account: $1l("account", 60313),
      gitPullRequestAssignee: $1l("git-pull-request-assignee", 60313),
      bellDot: $1l("bell-dot", 60314),
      debugConsole: $1l("debug-console", 60315),
      library: $1l("library", 60316),
      output: $1l("output", 60317),
      runAll: $1l("run-all", 60318),
      syncIgnored: $1l("sync-ignored", 60319),
      pinned: $1l("pinned", 60320),
      githubInverted: $1l("github-inverted", 60321),
      serverProcess: $1l("server-process", 60322),
      serverEnvironment: $1l("server-environment", 60323),
      pass: $1l("pass", 60324),
      issueClosed: $1l("issue-closed", 60324),
      stopCircle: $1l("stop-circle", 60325),
      playCircle: $1l("play-circle", 60326),
      record: $1l("record", 60327),
      debugAltSmall: $1l("debug-alt-small", 60328),
      vmConnect: $1l("vm-connect", 60329),
      cloud: $1l("cloud", 60330),
      merge: $1l("merge", 60331),
      export: $1l("export", 60332),
      graphLeft: $1l("graph-left", 60333),
      magnet: $1l("magnet", 60334),
      notebook: $1l("notebook", 60335),
      redo: $1l("redo", 60336),
      checkAll: $1l("check-all", 60337),
      pinnedDirty: $1l("pinned-dirty", 60338),
      passFilled: $1l("pass-filled", 60339),
      circleLargeFilled: $1l("circle-large-filled", 60340),
      circleLarge: $1l("circle-large", 60341),
      circleLargeOutline: $1l("circle-large-outline", 60341),
      combine: $1l("combine", 60342),
      gather: $1l("gather", 60342),
      table: $1l("table", 60343),
      variableGroup: $1l("variable-group", 60344),
      typeHierarchy: $1l("type-hierarchy", 60345),
      typeHierarchySub: $1l("type-hierarchy-sub", 60346),
      typeHierarchySuper: $1l("type-hierarchy-super", 60347),
      gitPullRequestCreate: $1l("git-pull-request-create", 60348),
      runAbove: $1l("run-above", 60349),
      runBelow: $1l("run-below", 60350),
      notebookTemplate: $1l("notebook-template", 60351),
      debugRerun: $1l("debug-rerun", 60352),
      workspaceTrusted: $1l("workspace-trusted", 60353),
      workspaceUntrusted: $1l("workspace-untrusted", 60354),
      workspaceUnknown: $1l("workspace-unknown", 60355),
      terminalCmd: $1l("terminal-cmd", 60356),
      terminalDebian: $1l("terminal-debian", 60357),
      terminalLinux: $1l("terminal-linux", 60358),
      terminalPowershell: $1l("terminal-powershell", 60359),
      terminalTmux: $1l("terminal-tmux", 60360),
      terminalUbuntu: $1l("terminal-ubuntu", 60361),
      terminalBash: $1l("terminal-bash", 60362),
      arrowSwap: $1l("arrow-swap", 60363),
      copy: $1l("copy", 60364),
      personAdd: $1l("person-add", 60365),
      filterFilled: $1l("filter-filled", 60366),
      wand: $1l("wand", 60367),
      debugLineByLine: $1l("debug-line-by-line", 60368),
      inspect: $1l("inspect", 60369),
      layers: $1l("layers", 60370),
      layersDot: $1l("layers-dot", 60371),
      layersActive: $1l("layers-active", 60372),
      compass: $1l("compass", 60373),
      compassDot: $1l("compass-dot", 60374),
      compassActive: $1l("compass-active", 60375),
      azure: $1l("azure", 60376),
      issueDraft: $1l("issue-draft", 60377),
      gitPullRequestClosed: $1l("git-pull-request-closed", 60378),
      gitPullRequestDraft: $1l("git-pull-request-draft", 60379),
      debugAll: $1l("debug-all", 60380),
      debugCoverage: $1l("debug-coverage", 60381),
      runErrors: $1l("run-errors", 60382),
      folderLibrary: $1l("folder-library", 60383),
      debugContinueSmall: $1l("debug-continue-small", 60384),
      beakerStop: $1l("beaker-stop", 60385),
      graphLine: $1l("graph-line", 60386),
      graphScatter: $1l("graph-scatter", 60387),
      pieChart: $1l("pie-chart", 60388),
      bracket: $1l("bracket", 60175),
      bracketDot: $1l("bracket-dot", 60389),
      bracketError: $1l("bracket-error", 60390),
      lockSmall: $1l("lock-small", 60391),
      azureDevops: $1l("azure-devops", 60392),
      verifiedFilled: $1l("verified-filled", 60393),
      newline: $1l("newline", 60394),
      layout: $1l("layout", 60395),
      layoutActivitybarLeft: $1l("layout-activitybar-left", 60396),
      layoutActivitybarRight: $1l("layout-activitybar-right", 60397),
      layoutPanelLeft: $1l("layout-panel-left", 60398),
      layoutPanelCenter: $1l("layout-panel-center", 60399),
      layoutPanelJustify: $1l("layout-panel-justify", 60400),
      layoutPanelRight: $1l("layout-panel-right", 60401),
      layoutPanel: $1l("layout-panel", 60402),
      layoutSidebarLeft: $1l("layout-sidebar-left", 60403),
      layoutSidebarRight: $1l("layout-sidebar-right", 60404),
      layoutStatusbar: $1l("layout-statusbar", 60405),
      layoutMenubar: $1l("layout-menubar", 60406),
      layoutCentered: $1l("layout-centered", 60407),
      target: $1l("target", 60408),
      indent: $1l("indent", 60409),
      recordSmall: $1l("record-small", 60410),
      errorSmall: $1l("error-small", 60411),
      terminalDecorationError: $1l("terminal-decoration-error", 60411),
      arrowCircleDown: $1l("arrow-circle-down", 60412),
      arrowCircleLeft: $1l("arrow-circle-left", 60413),
      arrowCircleRight: $1l("arrow-circle-right", 60414),
      arrowCircleUp: $1l("arrow-circle-up", 60415),
      layoutSidebarRightOff: $1l("layout-sidebar-right-off", 60416),
      layoutPanelOff: $1l("layout-panel-off", 60417),
      layoutSidebarLeftOff: $1l("layout-sidebar-left-off", 60418),
      blank: $1l("blank", 60419),
      heartFilled: $1l("heart-filled", 60420),
      map: $1l("map", 60421),
      mapHorizontal: $1l("map-horizontal", 60421),
      foldHorizontal: $1l("fold-horizontal", 60421),
      mapFilled: $1l("map-filled", 60422),
      mapHorizontalFilled: $1l("map-horizontal-filled", 60422),
      foldHorizontalFilled: $1l("fold-horizontal-filled", 60422),
      circleSmall: $1l("circle-small", 60423),
      bellSlash: $1l("bell-slash", 60424),
      bellSlashDot: $1l("bell-slash-dot", 60425),
      commentUnresolved: $1l("comment-unresolved", 60426),
      gitPullRequestGoToChanges: $1l("git-pull-request-go-to-changes", 60427),
      gitPullRequestNewChanges: $1l("git-pull-request-new-changes", 60428),
      searchFuzzy: $1l("search-fuzzy", 60429),
      commentDraft: $1l("comment-draft", 60430),
      send: $1l("send", 60431),
      sparkle: $1l("sparkle", 60432),
      insert: $1l("insert", 60433),
      mic: $1l("mic", 60434),
      thumbsdownFilled: $1l("thumbsdown-filled", 60435),
      thumbsupFilled: $1l("thumbsup-filled", 60436),
      coffee: $1l("coffee", 60437),
      snake: $1l("snake", 60438),
      game: $1l("game", 60439),
      vr: $1l("vr", 60440),
      chip: $1l("chip", 60441),
      piano: $1l("piano", 60442),
      music: $1l("music", 60443),
      micFilled: $1l("mic-filled", 60444),
      repoFetch: $1l("repo-fetch", 60445),
      copilot: $1l("copilot", 60446),
      lightbulbSparkle: $1l("lightbulb-sparkle", 60447),
      robot: $1l("robot", 60448),
      sparkleFilled: $1l("sparkle-filled", 60449),
      diffSingle: $1l("diff-single", 60450),
      diffMultiple: $1l("diff-multiple", 60451),
      surroundWith: $1l("surround-with", 60452),
      share: $1l("share", 60453),
      gitStash: $1l("git-stash", 60454),
      gitStashApply: $1l("git-stash-apply", 60455),
      gitStashPop: $1l("git-stash-pop", 60456),
      vscode: $1l("vscode", 60457),
      vscodeInsiders: $1l("vscode-insiders", 60458),
      codeOss: $1l("code-oss", 60459),
      runCoverage: $1l("run-coverage", 60460),
      runAllCoverage: $1l("run-all-coverage", 60461),
      coverage: $1l("coverage", 60462),
      githubProject: $1l("github-project", 60463),
      mapVertical: $1l("map-vertical", 60464),
      foldVertical: $1l("fold-vertical", 60464),
      mapVerticalFilled: $1l("map-vertical-filled", 60465),
      foldVerticalFilled: $1l("fold-vertical-filled", 60465),
      goToSearch: $1l("go-to-search", 60466),
      percentage: $1l("percentage", 60467),
      sortPercentage: $1l("sort-percentage", 60467),
      attach: $1l("attach", 60468),
      goToEditingSession: $1l("go-to-editing-session", 60469),
      editSession: $1l("edit-session", 60470),
      codeReview: $1l("code-review", 60471),
      copilotWarning: $1l("copilot-warning", 60472),
      python: $1l("python", 60473),
      copilotLarge: $1l("copilot-large", 60474),
      copilotWarningLarge: $1l("copilot-warning-large", 60475)
    };
  }
});

// out-build/vs/base/common/codicons.js
function $4l() {
  return Object.values($6l);
}
var $5l, $6l;
var init_codicons = __esm({
  "out-build/vs/base/common/codicons.js"() {
    "use strict";
    init_codiconsUtil();
    init_codiconsLibrary();
    $5l = {
      dialogError: $1l("dialog-error", "error"),
      dialogWarning: $1l("dialog-warning", "warning"),
      dialogInfo: $1l("dialog-info", "info"),
      dialogClose: $1l("dialog-close", "close"),
      treeItemExpanded: $1l("tree-item-expanded", "chevron-down"),
      // collapsed is done with rotation
      treeFilterOnTypeOn: $1l("tree-filter-on-type-on", "list-filter"),
      treeFilterOnTypeOff: $1l("tree-filter-on-type-off", "list-selection"),
      treeFilterClear: $1l("tree-filter-clear", "close"),
      treeItemLoading: $1l("tree-item-loading", "loading"),
      menuSelection: $1l("menu-selection", "check"),
      menuSubmenu: $1l("menu-submenu", "chevron-right"),
      menuBarMore: $1l("menubar-more", "more"),
      scrollbarButtonLeft: $1l("scrollbar-button-left", "triangle-left"),
      scrollbarButtonRight: $1l("scrollbar-button-right", "triangle-right"),
      scrollbarButtonUp: $1l("scrollbar-button-up", "triangle-up"),
      scrollbarButtonDown: $1l("scrollbar-button-down", "triangle-down"),
      toolBarMore: $1l("toolbar-more", "more"),
      quickInputBack: $1l("quick-input-back", "arrow-left"),
      dropDownButton: $1l("drop-down-button", 60084),
      symbolCustomColor: $1l("symbol-customcolor", 60252),
      exportIcon: $1l("export", 60332),
      workspaceUnspecified: $1l("workspace-unspecified", 60355),
      newLine: $1l("newline", 60394),
      thumbsDownFilled: $1l("thumbsdown-filled", 60435),
      thumbsUpFilled: $1l("thumbsup-filled", 60436),
      gitFetch: $1l("git-fetch", 60445),
      lightbulbSparkleAutofix: $1l("lightbulb-sparkle-autofix", 60447),
      debugBreakpointPending: $1l("debug-breakpoint-pending", 60377)
    };
    $6l = {
      ...$3l,
      ...$5l
    };
  }
});

// out-build/vs/base/common/themables.js
var ThemeColor, ThemeIcon;
var init_themables = __esm({
  "out-build/vs/base/common/themables.js"() {
    "use strict";
    init_codicons();
    (function(ThemeColor2) {
      function isThemeColor(obj) {
        return obj && typeof obj === "object" && typeof obj.id === "string";
      }
      ThemeColor2.isThemeColor = isThemeColor;
    })(ThemeColor || (ThemeColor = {}));
    (function(ThemeIcon2) {
      ThemeIcon2.iconNameSegment = "[A-Za-z0-9]+";
      ThemeIcon2.iconNameExpression = "[A-Za-z0-9-]+";
      ThemeIcon2.iconModifierExpression = "~[A-Za-z]+";
      ThemeIcon2.iconNameCharacter = "[A-Za-z0-9~-]";
      const ThemeIconIdRegex = new RegExp(`^(${ThemeIcon2.iconNameExpression})(${ThemeIcon2.iconModifierExpression})?$`);
      function asClassNameArray(icon) {
        const match = ThemeIconIdRegex.exec(icon.id);
        if (!match) {
          return asClassNameArray($6l.error);
        }
        const [, id2, modifier] = match;
        const classNames = ["codicon", "codicon-" + id2];
        if (modifier) {
          classNames.push("codicon-modifier-" + modifier.substring(1));
        }
        return classNames;
      }
      ThemeIcon2.asClassNameArray = asClassNameArray;
      function asClassName(icon) {
        return asClassNameArray(icon).join(" ");
      }
      ThemeIcon2.asClassName = asClassName;
      function asCSSSelector(icon) {
        return "." + asClassNameArray(icon).join(".");
      }
      ThemeIcon2.asCSSSelector = asCSSSelector;
      function isThemeIcon(obj) {
        return obj && typeof obj === "object" && typeof obj.id === "string" && (typeof obj.color === "undefined" || ThemeColor.isThemeColor(obj.color));
      }
      ThemeIcon2.isThemeIcon = isThemeIcon;
      const _regexFromString = new RegExp(`^\\$\\((${ThemeIcon2.iconNameExpression}(?:${ThemeIcon2.iconModifierExpression})?)\\)$`);
      function fromString(str) {
        const match = _regexFromString.exec(str);
        if (!match) {
          return void 0;
        }
        const [, name] = match;
        return { id: name };
      }
      ThemeIcon2.fromString = fromString;
      function fromId(id2) {
        return { id: id2 };
      }
      ThemeIcon2.fromId = fromId;
      function modify(icon, modifier) {
        let id2 = icon.id;
        const tildeIndex = id2.lastIndexOf("~");
        if (tildeIndex !== -1) {
          id2 = id2.substring(0, tildeIndex);
        }
        if (modifier) {
          id2 = `${id2}~${modifier}`;
        }
        return { id: id2 };
      }
      ThemeIcon2.modify = modify;
      function getModifier(icon) {
        const tildeIndex = icon.id.lastIndexOf("~");
        if (tildeIndex !== -1) {
          return icon.id.substring(tildeIndex + 1);
        }
        return void 0;
      }
      ThemeIcon2.getModifier = getModifier;
      function isEqual(ti1, ti2) {
        return ti1.id === ti2.id && ti1.color?.id === ti2.color?.id;
      }
      ThemeIcon2.isEqual = isEqual;
    })(ThemeIcon || (ThemeIcon = {}));
  }
});

// out-build/vs/base/common/iconLabels.js
function $8l(text) {
  return text.replace(escapeIconsRegex, (match, escaped) => escaped ? match : `\\${match}`);
}
var iconsRegex, escapeIconsRegex, markdownEscapedIconsRegex, stripIconsRegex, _parseIconsRegex;
var init_iconLabels = __esm({
  "out-build/vs/base/common/iconLabels.js"() {
    "use strict";
    init_filters();
    init_strings();
    init_themables();
    iconsRegex = new RegExp(`\\$\\(${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?\\)`, "g");
    escapeIconsRegex = new RegExp(`(\\\\)?${iconsRegex.source}`, "g");
    markdownEscapedIconsRegex = new RegExp(`\\\\${iconsRegex.source}`, "g");
    stripIconsRegex = new RegExp(`(\\s)?(\\\\)?${iconsRegex.source}(\\s)?`, "g");
    _parseIconsRegex = new RegExp(`\\$\\(${ThemeIcon.iconNameCharacter}+\\)`, "g");
  }
});

// out-build/vs/base/common/htmlContent.js
function $dm(thing) {
  if (thing instanceof $bm) {
    return true;
  } else if (thing && typeof thing === "object") {
    return typeof thing.value === "string" && (typeof thing.isTrusted === "boolean" || typeof thing.isTrusted === "object" || thing.isTrusted === void 0) && (typeof thing.supportThemeIcons === "boolean" || thing.supportThemeIcons === void 0);
  }
  return false;
}
function $fm(text) {
  return text.replace(/[\\`*_{}[\]()#+\-!~]/g, "\\$&");
}
function $gm(code, langId) {
  const longestFenceLength = code.match(/^`+/gm)?.reduce((a, b) => a.length > b.length ? a : b).length ?? 0;
  const desiredFenceLength = longestFenceLength >= 3 ? longestFenceLength + 1 : 3;
  return [
    `${"`".repeat(desiredFenceLength)}${langId}`,
    code,
    `${"`".repeat(desiredFenceLength)}`
  ].join("\n");
}
function $jm(href) {
  const dimensions = [];
  const splitted = href.split("|").map((s) => s.trim());
  href = splitted[0];
  const parameters = splitted[1];
  if (parameters) {
    const heightFromParams = /height=(\d+)/.exec(parameters);
    const widthFromParams = /width=(\d+)/.exec(parameters);
    const height = heightFromParams ? heightFromParams[1] : "";
    const width = widthFromParams ? widthFromParams[1] : "";
    const widthIsFinite = isFinite(parseInt(width));
    const heightIsFinite = isFinite(parseInt(height));
    if (widthIsFinite) {
      dimensions.push(`width="${width}"`);
    }
    if (heightIsFinite) {
      dimensions.push(`height="${height}"`);
    }
  }
  return { href, dimensions };
}
var MarkdownStringTextNewlineStyle, $bm;
var init_htmlContent = __esm({
  "out-build/vs/base/common/htmlContent.js"() {
    "use strict";
    init_errors();
    init_iconLabels();
    init_resources();
    init_strings();
    init_uri();
    (function(MarkdownStringTextNewlineStyle2) {
      MarkdownStringTextNewlineStyle2[MarkdownStringTextNewlineStyle2["Paragraph"] = 0] = "Paragraph";
      MarkdownStringTextNewlineStyle2[MarkdownStringTextNewlineStyle2["Break"] = 1] = "Break";
    })(MarkdownStringTextNewlineStyle || (MarkdownStringTextNewlineStyle = {}));
    $bm = class {
      constructor(value = "", isTrustedOrOptions = false) {
        this.value = value;
        if (typeof this.value !== "string") {
          throw $nb("value");
        }
        if (typeof isTrustedOrOptions === "boolean") {
          this.isTrusted = isTrustedOrOptions;
          this.supportThemeIcons = false;
          this.supportHtml = false;
        } else {
          this.isTrusted = isTrustedOrOptions.isTrusted ?? void 0;
          this.supportThemeIcons = isTrustedOrOptions.supportThemeIcons ?? false;
          this.supportHtml = isTrustedOrOptions.supportHtml ?? false;
        }
      }
      appendText(value, newlineStyle = 0) {
        this.value += $fm(this.supportThemeIcons ? $8l(value) : value).replace(/([ \t]+)/g, (_match, g1) => "&nbsp;".repeat(g1.length)).replace(/\>/gm, "\\>").replace(/\n/g, newlineStyle === 1 ? "\\\n" : "\n\n");
        return this;
      }
      appendMarkdown(value) {
        this.value += value;
        return this;
      }
      appendCodeblock(langId, code) {
        this.value += `
${$gm(code, langId)}
`;
        return this;
      }
      appendLink(target, label, title) {
        this.value += "[";
        this.value += this.c(label, "]");
        this.value += "](";
        this.value += this.c(String(target), ")");
        if (title) {
          this.value += ` "${this.c(this.c(title, '"'), ")")}"`;
        }
        this.value += ")";
        return this;
      }
      c(value, ch) {
        const r = new RegExp($Af(ch), "g");
        return value.replace(r, (match, offset) => {
          if (value.charAt(offset - 1) !== "\\") {
            return `\\${match}`;
          } else {
            return match;
          }
        });
      }
    };
  }
});

// out-build/vs/platform/extensionManagement/common/abstractExtensionManagementService.js
function $eX(error, code) {
  if (error instanceof $rA) {
    return error;
  }
  let extensionManagementError;
  if (error instanceof $qA) {
    extensionManagementError = new $rA(
      error.message,
      error.code === "DownloadFailedWriting" ? "DownloadFailedWriting" : "Gallery"
      /* ExtensionManagementErrorCode.Gallery */
    );
  } else {
    extensionManagementError = new $rA(error.message, $kb(error) ? "Cancelled" : code ?? "Internal");
  }
  extensionManagementError.stack = error.stack;
  return extensionManagementError;
}
function reportTelemetry(telemetryService, eventName, { extensionData, verificationStatus, duration, error, source, durationSinceUpdate }) {
  telemetryService.publicLog(eventName, {
    ...extensionData,
    source,
    duration,
    durationSinceUpdate,
    success: !error,
    errorcode: error?.code,
    verificationStatus: verificationStatus === ExtensionSignatureVerificationCode.Success ? "Verified" : verificationStatus ?? "Unverified"
  });
}
var $cX, $dX, $fX;
var init_abstractExtensionManagementService = __esm({
  "out-build/vs/platform/extensionManagement/common/abstractExtensionManagementService.js"() {
    "use strict";
    init_arrays();
    init_async();
    init_cancellation();
    init_errors();
    init_event();
    init_lifecycle();
    init_map();
    init_platform();
    init_uri();
    init_nls2();
    init_extensionManagement();
    init_extensionManagementUtil();
    init_extensions();
    init_extensionValidator();
    init_log();
    init_productService();
    init_telemetry();
    init_uriIdentity();
    init_userDataProfile();
    init_htmlContent();
    $cX = class $cX2 extends $3c {
      constructor(g, h) {
        super();
        this.g = g;
        this.h = h;
      }
      async canInstall(extension) {
        const allowedToInstall = this.h.isAllowed({ id: extension.identifier.id, publisherDisplayName: extension.publisherDisplayName });
        if (allowedToInstall !== true) {
          return new $bm(localize(1798, null, allowedToInstall.value));
        }
        if (!await this.j(extension)) {
          const productName = $r ? localize(1799, null, this.g.nameLong) : this.g.nameLong;
          const learnLink = $r ? "https://aka.ms/vscode-web-extensions-guide" : "https://aka.ms/vscode-platform-specific-extensions";
          return new $bm(`${localize(1800, null, extension.displayName ?? extension.identifier.id, productName, $jA(await this.getTargetPlatform()))} [${localize(1801, null)}](${learnLink})`);
        }
        return true;
      }
      async j(extension) {
        const currentTargetPlatform = await this.getTargetPlatform();
        return extension.allTargetPlatforms.some((targetPlatform) => $nA(targetPlatform, extension.allTargetPlatforms, currentTargetPlatform));
      }
    };
    $cX = __decorate([
      __param(0, $Vu),
      __param(1, $xA)
    ], $cX);
    $dX = class $dX2 extends $cX {
      get onInstallExtension() {
        return this.u.event;
      }
      get onDidInstallExtensions() {
        return this.w.event;
      }
      get onUninstallExtension() {
        return this.y.event;
      }
      get onDidUninstallExtension() {
        return this.z.event;
      }
      get onDidUpdateExtensionMetadata() {
        return this.C.event;
      }
      constructor(F, G, H, I, productService, allowedExtensionsService, J) {
        super(productService, allowedExtensionsService);
        this.F = F;
        this.G = G;
        this.H = H;
        this.I = I;
        this.J = J;
        this.n = 0;
        this.s = /* @__PURE__ */ new Map();
        this.t = /* @__PURE__ */ new Map();
        this.u = this.B(new $ze());
        this.w = this.B(new $ze());
        this.y = this.B(new $ze());
        this.z = this.B(new $ze());
        this.C = this.B(new $ze());
        this.D = [];
        this.B($1c(() => {
          this.s.forEach(({ task }) => task.cancel());
          this.t.forEach((promise) => promise.cancel());
          this.s.clear();
          this.t.clear();
        }));
      }
      async installFromGallery(extension, options2 = {}) {
        try {
          const results = await this.installGalleryExtensions([{ extension, options: options2 }]);
          const result = results.find(({ identifier }) => $DA(identifier, extension.identifier));
          if (result?.local) {
            return result?.local;
          }
          if (result?.error) {
            throw result.error;
          }
          throw new $rA(
            `Unknown error while installing extension ${extension.identifier.id}`,
            "Unknown"
            /* ExtensionManagementErrorCode.Unknown */
          );
        } catch (error) {
          throw $eX(error);
        }
      }
      async installGalleryExtensions(extensions) {
        if (!this.F.isEnabled()) {
          throw new $rA(
            localize(1802, null),
            "NotAllowed"
            /* ExtensionManagementErrorCode.NotAllowed */
          );
        }
        const results = [];
        const installableExtensions = [];
        await Promise.allSettled(extensions.map(async ({ extension, options: options2 }) => {
          try {
            const compatible = await this.Q(extension, !!options2?.installGivenVersion, !!options2?.installPreReleaseVersion, options2.productVersion ?? { version: this.g.version, date: this.g.date });
            installableExtensions.push({ ...compatible, options: options2 });
          } catch (error) {
            results.push({ identifier: extension.identifier, operation: 2, source: extension, error, profileLocation: options2.profileLocation ?? this.Z() });
          }
        }));
        if (installableExtensions.length) {
          results.push(...await this.L(installableExtensions));
        }
        return results;
      }
      async uninstall(extension, options2) {
        this.I.trace("ExtensionManagementService#uninstall", extension.identifier.id);
        return this.uninstallExtensions([{ extension, options: options2 }]);
      }
      async toggleAppliationScope(extension, fromProfileLocation) {
        if ($8z(extension.manifest) || extension.isBuiltin) {
          return extension;
        }
        if (extension.isApplicationScoped) {
          let local = await this.updateMetadata(extension, { isApplicationScoped: false }, this.J.defaultProfile.extensionsResource);
          if (!this.H.extUri.isEqual(fromProfileLocation, this.J.defaultProfile.extensionsResource)) {
            local = await this.bb(extension, this.J.defaultProfile.extensionsResource, fromProfileLocation);
          }
          for (const profile of this.J.profiles) {
            const existing = (await this.getInstalled(1, profile.extensionsResource)).find((e) => $DA(e.identifier, extension.identifier));
            if (existing) {
              this.C.fire({ local: existing, profileLocation: profile.extensionsResource });
            } else {
              this.z.fire({ identifier: extension.identifier, profileLocation: profile.extensionsResource });
            }
          }
          return local;
        } else {
          const local = this.H.extUri.isEqual(fromProfileLocation, this.J.defaultProfile.extensionsResource) ? await this.updateMetadata(extension, { isApplicationScoped: true }, this.J.defaultProfile.extensionsResource) : await this.bb(extension, fromProfileLocation, this.J.defaultProfile.extensionsResource, { isApplicationScoped: true });
          this.w.fire([{ identifier: local.identifier, operation: 2, local, profileLocation: this.J.defaultProfile.extensionsResource, applicationScoped: true }]);
          return local;
        }
      }
      getExtensionsControlManifest() {
        const now2 = (/* @__PURE__ */ new Date()).getTime();
        if (!this.m || now2 - this.n > 1e3 * 60 * 5) {
          this.m = this.Y();
          this.n = now2;
        }
        return this.m;
      }
      registerParticipant(participant) {
        this.D.push(participant);
      }
      async resetPinnedStateForAllUserExtensions(pinned) {
        try {
          await this.O(this.J.profiles.map(async (profile) => {
            const extensions = await this.getInstalled(1, profile.extensionsResource);
            await this.O(extensions.map(async (extension) => {
              if (extension.pinned !== pinned) {
                await this.updateMetadata(extension, { pinned }, profile.extensionsResource);
              }
            }));
          }));
        } catch (error) {
          this.I.error("Error while resetting pinned state for all user extensions", $qb(error));
          throw error;
        }
      }
      async L(extensions) {
        const installExtensionResultsMap = /* @__PURE__ */ new Map();
        const installingExtensionsMap = /* @__PURE__ */ new Map();
        const alreadyRequestedInstallations = [];
        const getInstallExtensionTaskKey = (extension, profileLocation) => `${$EA.create(extension).toString()}-${profileLocation.toString()}`;
        const createInstallExtensionTask = (manifest, extension, options2, root) => {
          if (!URI.isUri(extension)) {
            if (installingExtensionsMap.has(`${extension.identifier.id.toLowerCase()}-${options2.profileLocation.toString()}`)) {
              return;
            }
            const existingInstallingExtension = this.s.get(getInstallExtensionTaskKey(extension, options2.profileLocation));
            if (existingInstallingExtension) {
              if (root && this.N(root, existingInstallingExtension.task)) {
                const identifier = existingInstallingExtension.task.identifier;
                this.I.info("Waiting for already requested installing extension", identifier.id, root.identifier.id, options2.profileLocation.toString());
                existingInstallingExtension.waitingTasks.push(root);
                alreadyRequestedInstallations.push(Event.toPromise(Event.filter(this.onDidInstallExtensions, (results2) => results2.some((result) => $DA(result.identifier, identifier)))).then((results2) => {
                  this.I.info("Finished waiting for already requested installing extension", identifier.id, root.identifier.id, options2.profileLocation.toString());
                  const result = results2.find((result2) => $DA(result2.identifier, identifier));
                  if (!result?.local) {
                    throw new Error(`Extension ${identifier.id} is not installed`);
                  }
                }));
              }
              return;
            }
          }
          const installExtensionTask = this.$(manifest, extension, options2);
          const key = `${$IA(manifest.publisher, manifest.name)}-${options2.profileLocation.toString()}`;
          installingExtensionsMap.set(key, { task: installExtensionTask, root });
          this.u.fire({ identifier: installExtensionTask.identifier, source: extension, profileLocation: options2.profileLocation });
          this.I.info("Installing extension:", installExtensionTask.identifier.id, options2);
          if (!URI.isUri(extension)) {
            this.s.set(getInstallExtensionTaskKey(extension, options2.profileLocation), { task: installExtensionTask, waitingTasks: [] });
          }
        };
        try {
          for (const { manifest, extension, options: options2 } of extensions) {
            const isApplicationScoped = options2.isApplicationScoped || options2.isBuiltin || $8z(manifest);
            const installExtensionTaskOptions = {
              ...options2,
              installOnlyNewlyAddedFromExtensionPack: options2.installOnlyNewlyAddedFromExtensionPack ?? !URI.isUri(extension),
              isApplicationScoped,
              profileLocation: isApplicationScoped ? this.J.defaultProfile.extensionsResource : options2.profileLocation ?? this.Z(),
              productVersion: options2.productVersion ?? { version: this.g.version, date: this.g.date }
            };
            const existingInstallExtensionTask = !URI.isUri(extension) ? this.s.get(getInstallExtensionTaskKey(extension, installExtensionTaskOptions.profileLocation)) : void 0;
            if (existingInstallExtensionTask) {
              this.I.info("Extension is already requested to install", existingInstallExtensionTask.task.identifier.id, installExtensionTaskOptions.profileLocation.toString());
              alreadyRequestedInstallations.push(existingInstallExtensionTask.task.waitUntilTaskIsFinished());
            } else {
              createInstallExtensionTask(manifest, extension, installExtensionTaskOptions, void 0);
            }
          }
          await Promise.all([...installingExtensionsMap.values()].map(async ({ task }) => {
            if (task.options.donotIncludePackAndDependencies) {
              this.I.info("Installing the extension without checking dependencies and pack", task.identifier.id);
            } else {
              try {
                const allDepsAndPackExtensionsToInstall = await this.P(task.identifier, task.manifest, !!task.options.installOnlyNewlyAddedFromExtensionPack, !!task.options.installPreReleaseVersion, task.options.profileLocation, task.options.productVersion);
                const installed = await this.getInstalled(void 0, task.options.profileLocation, task.options.productVersion);
                const options2 = { ...task.options, context: { ...task.options.context, [$hA]: true } };
                for (const { gallery, manifest } of $Rb(allDepsAndPackExtensionsToInstall, ({ gallery: gallery2 }) => gallery2.identifier.id)) {
                  if (installed.some(({ identifier }) => $DA(identifier, gallery.identifier))) {
                    continue;
                  }
                  createInstallExtensionTask(manifest, gallery, options2, task);
                }
              } catch (error) {
                if (URI.isUri(task.source)) {
                  if ($Qb(task.manifest.extensionDependencies)) {
                    this.I.warn(`Cannot install dependencies of extension:`, task.identifier.id, error.message);
                  }
                  if ($Qb(task.manifest.extensionPack)) {
                    this.I.warn(`Cannot install packed extensions of extension:`, task.identifier.id, error.message);
                  }
                } else {
                  this.I.error("Error while preparing to install dependencies and extension packs of the extension:", task.identifier.id);
                  throw error;
                }
              }
            }
          }));
          const otherProfilesToUpdate = await this.M([...installingExtensionsMap.values()].map(({ task }) => task));
          for (const [profileLocation, task] of otherProfilesToUpdate) {
            createInstallExtensionTask(task.manifest, task.source, { ...task.options, profileLocation }, void 0);
          }
          await this.O([...installingExtensionsMap.entries()].map(async ([key, { task }]) => {
            const startTime = (/* @__PURE__ */ new Date()).getTime();
            let local;
            try {
              local = await task.run();
              await this.O(
                this.D.map((participant) => participant.postInstall(local, task.source, task.options, CancellationToken.None)),
                "PostInstall"
                /* ExtensionManagementErrorCode.PostInstall */
              );
            } catch (e) {
              const error = $eX(e);
              if (!URI.isUri(task.source)) {
                reportTelemetry(this.G, task.operation === 3 ? "extensionGallery:update" : "extensionGallery:install", {
                  extensionData: $LA(task.source),
                  error,
                  source: task.options.context?.[$gA]
                });
              }
              installExtensionResultsMap.set(key, { error, identifier: task.identifier, operation: task.operation, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, applicationScoped: task.options.isApplicationScoped });
              this.I.error("Error while installing the extension", task.identifier.id, $qb(error), task.options.profileLocation.toString());
              throw error;
            }
            if (!URI.isUri(task.source)) {
              const isUpdate = task.operation === 3;
              const durationSinceUpdate = isUpdate ? void 0 : ((/* @__PURE__ */ new Date()).getTime() - task.source.lastUpdated) / 1e3;
              reportTelemetry(this.G, isUpdate ? "extensionGallery:update" : "extensionGallery:install", {
                extensionData: $LA(task.source),
                verificationStatus: task.verificationStatus,
                duration: (/* @__PURE__ */ new Date()).getTime() - startTime,
                durationSinceUpdate,
                source: task.options.context?.[$gA]
              });
              if ($r && task.operation !== 3) {
                try {
                  await this.F.reportStatistic(
                    local.manifest.publisher,
                    local.manifest.name,
                    local.manifest.version,
                    "install"
                    /* StatisticType.Install */
                  );
                } catch (error) {
                }
              }
            }
            installExtensionResultsMap.set(key, { local, identifier: task.identifier, operation: task.operation, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, applicationScoped: local.isApplicationScoped });
          }));
          if (alreadyRequestedInstallations.length) {
            await this.O(alreadyRequestedInstallations);
          }
        } catch (error) {
          const getAllDepsAndPacks = (extension, profileLocation, allDepsOrPacks) => {
            const depsOrPacks = [];
            if (extension.manifest.extensionDependencies?.length) {
              depsOrPacks.push(...extension.manifest.extensionDependencies);
            }
            if (extension.manifest.extensionPack?.length) {
              depsOrPacks.push(...extension.manifest.extensionPack);
            }
            for (const id2 of depsOrPacks) {
              if (allDepsOrPacks.includes(id2.toLowerCase())) {
                continue;
              }
              allDepsOrPacks.push(id2.toLowerCase());
              const installed = installExtensionResultsMap.get(`${id2.toLowerCase()}-${profileLocation.toString()}`);
              if (installed?.local) {
                allDepsOrPacks = getAllDepsAndPacks(installed.local, profileLocation, allDepsOrPacks);
              }
            }
            return allDepsOrPacks;
          };
          const getErrorResult = (task) => ({ identifier: task.identifier, operation: 2, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, error });
          const rollbackTasks = [];
          for (const [key, { task, root }] of installingExtensionsMap) {
            const result = installExtensionResultsMap.get(key);
            if (!result) {
              task.cancel();
              installExtensionResultsMap.set(key, getErrorResult(task));
            } else if (result.local && root && !installExtensionResultsMap.get(`${root.identifier.id.toLowerCase()}-${task.options.profileLocation.toString()}`)?.local) {
              rollbackTasks.push(this.ab(result.local, { versionOnly: true, profileLocation: task.options.profileLocation }));
              installExtensionResultsMap.set(key, getErrorResult(task));
            }
          }
          for (const [key, { task }] of installingExtensionsMap) {
            const result = installExtensionResultsMap.get(key);
            if (!result?.local) {
              continue;
            }
            if (task.options.donotIncludePackAndDependencies) {
              continue;
            }
            const depsOrPacks = getAllDepsAndPacks(result.local, task.options.profileLocation, [result.local.identifier.id.toLowerCase()]).slice(1);
            if (depsOrPacks.some((depOrPack) => installingExtensionsMap.has(`${depOrPack.toLowerCase()}-${task.options.profileLocation.toString()}`) && !installExtensionResultsMap.get(`${depOrPack.toLowerCase()}-${task.options.profileLocation.toString()}`)?.local)) {
              rollbackTasks.push(this.ab(result.local, { versionOnly: true, profileLocation: task.options.profileLocation }));
              installExtensionResultsMap.set(key, getErrorResult(task));
            }
          }
          if (rollbackTasks.length) {
            await Promise.allSettled(rollbackTasks.map(async (rollbackTask) => {
              try {
                await rollbackTask.run();
                this.I.info("Rollback: Uninstalled extension", rollbackTask.extension.identifier.id);
              } catch (error2) {
                this.I.warn("Rollback: Error while uninstalling extension", rollbackTask.extension.identifier.id, $qb(error2));
              }
            }));
          }
        } finally {
          for (const { task } of installingExtensionsMap.values()) {
            if (task.source && !URI.isUri(task.source)) {
              this.s.delete(getInstallExtensionTaskKey(task.source, task.options.profileLocation));
            }
          }
        }
        const results = [...installExtensionResultsMap.values()];
        for (const result of results) {
          if (result.local) {
            this.I.info(`Extension installed successfully:`, result.identifier.id, result.profileLocation.toString());
          }
        }
        this.w.fire(results);
        return results;
      }
      async M(tasks) {
        const otherProfilesToUpdate = [];
        const profileExtensionsCache = new $Ec();
        for (const task of tasks) {
          if (task.operation !== 3 || task.options.isApplicationScoped || task.options.pinned || task.options.installGivenVersion || URI.isUri(task.source)) {
            continue;
          }
          for (const profile of this.J.profiles) {
            if (this.H.extUri.isEqual(profile.extensionsResource, task.options.profileLocation)) {
              continue;
            }
            let installedExtensions = profileExtensionsCache.get(profile.extensionsResource);
            if (!installedExtensions) {
              installedExtensions = await this.getInstalled(1, profile.extensionsResource);
              profileExtensionsCache.set(profile.extensionsResource, installedExtensions);
            }
            const installedExtension = installedExtensions.find((e) => $DA(e.identifier, task.identifier));
            if (installedExtension && !installedExtension.pinned) {
              otherProfilesToUpdate.push([profile.extensionsResource, task]);
            }
          }
        }
        return otherProfilesToUpdate;
      }
      N(taskToWait, taskToWaitFor) {
        for (const [, { task, waitingTasks }] of this.s.entries()) {
          if (task === taskToWait) {
            if (waitingTasks.includes(taskToWaitFor)) {
              return false;
            }
            if (waitingTasks.some((waitingTask) => this.N(waitingTask, taskToWaitFor))) {
              return false;
            }
          }
          if (task === taskToWaitFor && waitingTasks[0] && !this.N(taskToWait, waitingTasks[0])) {
            return false;
          }
        }
        return true;
      }
      async O(promises15, errorCode) {
        const results = [];
        const errors = [];
        const promiseResults = await Promise.allSettled(promises15);
        for (const r of promiseResults) {
          if (r.status === "fulfilled") {
            results.push(r.value);
          } else {
            errors.push($eX(r.reason, errorCode));
          }
        }
        if (!errors.length) {
          return results;
        }
        if (errors.length === 1) {
          throw errors[0];
        }
        let error = new $rA(
          "",
          "Unknown"
          /* ExtensionManagementErrorCode.Unknown */
        );
        for (const current of errors) {
          error = new $rA(error.message ? `${error.message}, ${current.message}` : current.message, current.code !== "Unknown" && current.code !== "Internal" ? current.code : error.code);
        }
        throw error;
      }
      async P(extensionIdentifier, manifest, getOnlyNewlyAddedFromExtensionPack, installPreRelease, profile, productVersion) {
        if (!this.F.isEnabled()) {
          return [];
        }
        const installed = await this.getInstalled(void 0, profile, productVersion);
        const knownIdentifiers = [];
        const allDependenciesAndPacks = [];
        const collectDependenciesAndPackExtensionsToInstall = async (extensionIdentifier2, manifest2) => {
          knownIdentifiers.push(extensionIdentifier2);
          const dependecies = manifest2.extensionDependencies || [];
          const dependenciesAndPackExtensions = [...dependecies];
          if (manifest2.extensionPack) {
            const existing = getOnlyNewlyAddedFromExtensionPack ? installed.find((e) => $DA(e.identifier, extensionIdentifier2)) : void 0;
            for (const extension of manifest2.extensionPack) {
              if (!(existing && existing.manifest.extensionPack && existing.manifest.extensionPack.some((old) => $DA({ id: old }, { id: extension })))) {
                if (dependenciesAndPackExtensions.every((e) => !$DA({ id: e }, { id: extension }))) {
                  dependenciesAndPackExtensions.push(extension);
                }
              }
            }
          }
          if (dependenciesAndPackExtensions.length) {
            const ids = dependenciesAndPackExtensions.filter((id2) => knownIdentifiers.every((galleryIdentifier) => !$DA(galleryIdentifier, { id: id2 })));
            if (ids.length) {
              const galleryExtensions = await this.F.getExtensions(ids.map((id2) => ({ id: id2, preRelease: installPreRelease })), CancellationToken.None);
              for (const galleryExtension of galleryExtensions) {
                if (knownIdentifiers.find((identifier) => $DA(identifier, galleryExtension.identifier))) {
                  continue;
                }
                const isDependency = dependecies.some((id2) => $DA({ id: id2 }, galleryExtension.identifier));
                let compatible;
                try {
                  compatible = await this.Q(galleryExtension, false, installPreRelease, productVersion);
                } catch (error) {
                  if (!isDependency) {
                    this.I.info("Skipping the packed extension as it cannot be installed", galleryExtension.identifier.id, $qb(error));
                    continue;
                  } else {
                    throw error;
                  }
                }
                allDependenciesAndPacks.push({ gallery: compatible.extension, manifest: compatible.manifest });
                await collectDependenciesAndPackExtensionsToInstall(compatible.extension.identifier, compatible.manifest);
              }
            }
          }
        };
        await collectDependenciesAndPackExtensionsToInstall(extensionIdentifier, manifest);
        return allDependenciesAndPacks;
      }
      async Q(extension, sameVersion, installPreRelease, productVersion) {
        let compatibleExtension;
        const extensionsControlManifest = await this.getExtensionsControlManifest();
        if (extensionsControlManifest.malicious.some((identifier) => $DA(extension.identifier, identifier))) {
          throw new $rA(
            localize(1803, null, extension.identifier.id),
            "Malicious"
            /* ExtensionManagementErrorCode.Malicious */
          );
        }
        const deprecationInfo = extensionsControlManifest.deprecated[extension.identifier.id.toLowerCase()];
        if (deprecationInfo?.extension?.autoMigrate) {
          this.I.info(`The '${extension.identifier.id}' extension is deprecated, fetching the compatible '${deprecationInfo.extension.id}' extension instead.`);
          compatibleExtension = (await this.F.getExtensions([{ id: deprecationInfo.extension.id, preRelease: deprecationInfo.extension.preRelease }], { targetPlatform: await this.getTargetPlatform(), compatible: true, productVersion }, CancellationToken.None))[0];
          if (!compatibleExtension) {
            throw new $rA(
              localize(1804, null, extension.identifier.id, deprecationInfo.extension.id),
              "Deprecated"
              /* ExtensionManagementErrorCode.Deprecated */
            );
          }
        } else {
          if (await this.canInstall(extension) !== true) {
            const targetPlatform = await this.getTargetPlatform();
            throw new $rA(
              localize(1805, null, extension.identifier.id, this.g.nameLong, $jA(targetPlatform)),
              "IncompatibleTargetPlatform"
              /* ExtensionManagementErrorCode.IncompatibleTargetPlatform */
            );
          }
          compatibleExtension = await this.R(extension, sameVersion, installPreRelease, productVersion);
          if (!compatibleExtension) {
            const incompatibleApiProposalsMessages = [];
            if (!$2A(extension.properties.enabledApiProposals ?? [], incompatibleApiProposalsMessages)) {
              throw new $rA(
                localize(1806, null, extension.displayName ?? extension.identifier.id, incompatibleApiProposalsMessages[0]),
                "IncompatibleApi"
                /* ExtensionManagementErrorCode.IncompatibleApi */
              );
            }
            if (!installPreRelease && extension.properties.isPreReleaseVersion && (await this.F.getExtensions([extension.identifier], CancellationToken.None))[0]) {
              throw new $rA(
                localize(1807, null, extension.displayName ?? extension.identifier.id),
                "ReleaseVersionNotFound"
                /* ExtensionManagementErrorCode.ReleaseVersionNotFound */
              );
            }
            throw new $rA(
              localize(1808, null, extension.identifier.id, this.g.nameLong, this.g.version),
              "Incompatible"
              /* ExtensionManagementErrorCode.Incompatible */
            );
          }
        }
        this.I.info("Getting Manifest...", compatibleExtension.identifier.id);
        const manifest = await this.F.getManifest(compatibleExtension, CancellationToken.None);
        if (manifest === null) {
          throw new $rA(
            `Missing manifest for extension ${compatibleExtension.identifier.id}`,
            "Invalid"
            /* ExtensionManagementErrorCode.Invalid */
          );
        }
        if (manifest.version !== compatibleExtension.version) {
          throw new $rA(
            `Cannot install '${compatibleExtension.identifier.id}' extension because of version mismatch in Marketplace`,
            "Invalid"
            /* ExtensionManagementErrorCode.Invalid */
          );
        }
        return { extension: compatibleExtension, manifest };
      }
      async R(extension, sameVersion, includePreRelease, productVersion) {
        const targetPlatform = await this.getTargetPlatform();
        let compatibleExtension = null;
        if (!sameVersion && extension.hasPreReleaseVersion && extension.properties.isPreReleaseVersion !== includePreRelease) {
          compatibleExtension = (await this.F.getExtensions([{ ...extension.identifier, preRelease: includePreRelease }], { targetPlatform, compatible: true, productVersion }, CancellationToken.None))[0] || null;
        }
        if (!compatibleExtension && await this.F.isExtensionCompatible(extension, includePreRelease, targetPlatform, productVersion)) {
          compatibleExtension = extension;
        }
        if (!compatibleExtension) {
          if (sameVersion) {
            compatibleExtension = (await this.F.getExtensions([{ ...extension.identifier, version: extension.version }], { targetPlatform, compatible: true, productVersion }, CancellationToken.None))[0] || null;
          } else {
            compatibleExtension = await this.F.getCompatibleExtension(extension, includePreRelease, targetPlatform, productVersion);
          }
        }
        return compatibleExtension;
      }
      async uninstallExtensions(extensions) {
        const getUninstallExtensionTaskKey = (extension, uninstallOptions) => `${extension.identifier.id.toLowerCase()}${uninstallOptions.versionOnly ? `-${extension.manifest.version}` : ""}@${uninstallOptions.profileLocation.toString()}`;
        const createUninstallExtensionTask = (extension, uninstallOptions) => {
          const uninstallExtensionTask = this.ab(extension, uninstallOptions);
          this.t.set(getUninstallExtensionTaskKey(uninstallExtensionTask.extension, uninstallOptions), uninstallExtensionTask);
          this.I.info("Uninstalling extension from the profile:", `${extension.identifier.id}@${extension.manifest.version}`, uninstallOptions.profileLocation.toString());
          this.y.fire({ identifier: extension.identifier, profileLocation: uninstallOptions.profileLocation, applicationScoped: extension.isApplicationScoped });
          return uninstallExtensionTask;
        };
        const postUninstallExtension = (extension, uninstallOptions, error) => {
          if (error) {
            this.I.error("Failed to uninstall extension from the profile:", `${extension.identifier.id}@${extension.manifest.version}`, uninstallOptions.profileLocation.toString(), error.message);
          } else {
            this.I.info("Successfully uninstalled extension from the profile", `${extension.identifier.id}@${extension.manifest.version}`, uninstallOptions.profileLocation.toString());
          }
          reportTelemetry(this.G, "extensionGallery:uninstall", { extensionData: $KA(extension), error });
          this.z.fire({ identifier: extension.identifier, error: error?.code, profileLocation: uninstallOptions.profileLocation, applicationScoped: extension.isApplicationScoped });
        };
        const allTasks = [];
        const processedTasks = [];
        const alreadyRequestedUninstalls = [];
        const installedExtensionsMap = new $Ec();
        for (const { extension, options: options2 } of extensions) {
          const uninstallOptions = {
            ...options2,
            profileLocation: extension.isApplicationScoped ? this.J.defaultProfile.extensionsResource : options2?.profileLocation ?? this.Z()
          };
          const uninstallExtensionTask = this.t.get(getUninstallExtensionTaskKey(extension, uninstallOptions));
          if (uninstallExtensionTask) {
            this.I.info("Extensions is already requested to uninstall", extension.identifier.id);
            alreadyRequestedUninstalls.push(uninstallExtensionTask.waitUntilTaskIsFinished());
          } else {
            allTasks.push(createUninstallExtensionTask(extension, uninstallOptions));
          }
        }
        try {
          for (const task of allTasks.slice(0)) {
            let installed = installedExtensionsMap.get(task.options.profileLocation);
            if (!installed) {
              installedExtensionsMap.set(task.options.profileLocation, installed = await this.getInstalled(1, task.options.profileLocation));
            }
            if (task.options.donotIncludePack) {
              this.I.info("Uninstalling the extension without including packed extension", `${task.extension.identifier.id}@${task.extension.manifest.version}`);
            } else {
              const packedExtensions = this.W(task.extension, installed);
              for (const packedExtension of packedExtensions) {
                if (this.t.has(getUninstallExtensionTaskKey(packedExtension, task.options))) {
                  this.I.info("Extensions is already requested to uninstall", packedExtension.identifier.id);
                } else {
                  allTasks.push(createUninstallExtensionTask(packedExtension, task.options));
                }
              }
            }
            if (task.options.donotCheckDependents) {
              this.I.info("Uninstalling the extension without checking dependents", `${task.extension.identifier.id}@${task.extension.manifest.version}`);
            } else {
              this.S(allTasks.map((task2) => task2.extension), installed, task.extension);
            }
          }
          await this.O(allTasks.map(async (task) => {
            try {
              await task.run();
              await this.O(this.D.map((participant) => participant.postUninstall(task.extension, task.options, CancellationToken.None)));
              if (task.extension.identifier.uuid) {
                try {
                  await this.F.reportStatistic(
                    task.extension.manifest.publisher,
                    task.extension.manifest.name,
                    task.extension.manifest.version,
                    "uninstall"
                    /* StatisticType.Uninstall */
                  );
                } catch (error) {
                }
              }
            } catch (e) {
              const error = $eX(e);
              postUninstallExtension(task.extension, task.options, error);
              throw error;
            } finally {
              processedTasks.push(task);
            }
          }));
          if (alreadyRequestedUninstalls.length) {
            await this.O(alreadyRequestedUninstalls);
          }
          for (const task of allTasks) {
            postUninstallExtension(task.extension, task.options);
          }
        } catch (e) {
          const error = $eX(e);
          for (const task of allTasks) {
            try {
              task.cancel();
            } catch (error2) {
            }
            if (!processedTasks.includes(task)) {
              postUninstallExtension(task.extension, task.options, error);
            }
          }
          throw error;
        } finally {
          for (const task of allTasks) {
            if (!this.t.delete(getUninstallExtensionTaskKey(task.extension, task.options))) {
              this.I.warn("Uninstallation task is not found in the cache", task.extension.identifier.id);
            }
          }
        }
      }
      S(extensionsToUninstall, installed, extensionToUninstall) {
        for (const extension of extensionsToUninstall) {
          const dependents = this.X(extension, installed);
          if (dependents.length) {
            const remainingDependents = dependents.filter((dependent) => !extensionsToUninstall.some((e) => $DA(e.identifier, dependent.identifier)));
            if (remainingDependents.length) {
              throw new Error(this.U(extension, remainingDependents, extensionToUninstall));
            }
          }
        }
      }
      U(dependingExtension, dependents, extensionToUninstall) {
        if (extensionToUninstall === dependingExtension) {
          if (dependents.length === 1) {
            return localize(1809, null, extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name);
          }
          if (dependents.length === 2) {
            return localize(1810, null, extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name, dependents[1].manifest.displayName || dependents[1].manifest.name);
          }
          return localize(1811, null, extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name, dependents[1].manifest.displayName || dependents[1].manifest.name);
        }
        if (dependents.length === 1) {
          return localize(1812, null, extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependingExtension.manifest.displayName || dependingExtension.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name);
        }
        if (dependents.length === 2) {
          return localize(1813, null, extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependingExtension.manifest.displayName || dependingExtension.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name, dependents[1].manifest.displayName || dependents[1].manifest.name);
        }
        return localize(1814, null, extensionToUninstall.manifest.displayName || extensionToUninstall.manifest.name, dependingExtension.manifest.displayName || dependingExtension.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name, dependents[1].manifest.displayName || dependents[1].manifest.name);
      }
      W(extension, installed, checked = []) {
        if (checked.indexOf(extension) !== -1) {
          return [];
        }
        checked.push(extension);
        const extensionsPack = extension.manifest.extensionPack ? extension.manifest.extensionPack : [];
        if (extensionsPack.length) {
          const packedExtensions = installed.filter((i) => !i.isBuiltin && extensionsPack.some((id2) => $DA({ id: id2 }, i.identifier)));
          const packOfPackedExtensions = [];
          for (const packedExtension of packedExtensions) {
            packOfPackedExtensions.push(...this.W(packedExtension, installed, checked));
          }
          return [...packedExtensions, ...packOfPackedExtensions];
        }
        return [];
      }
      X(extension, installed) {
        return installed.filter((e) => e.manifest.extensionDependencies && e.manifest.extensionDependencies.some((id2) => $DA({ id: id2 }, extension.identifier)));
      }
      async Y() {
        try {
          this.I.trace("ExtensionManagementService.updateControlCache");
          return await this.F.getExtensionsControlManifest();
        } catch (err) {
          this.I.trace("ExtensionManagementService.refreshControlCache - failed to get extension control manifest", $qb(err));
          return { malicious: [], deprecated: {}, search: [] };
        }
      }
    };
    $dX = __decorate([
      __param(0, $pA),
      __param(1, $zv),
      __param(2, $vl),
      __param(3, $wn),
      __param(4, $Vu),
      __param(5, $xA),
      __param(6, $rs)
    ], $dX);
    $fX = class {
      constructor() {
        this.d = new $Uh();
      }
      async waitUntilTaskIsFinished() {
        await this.d.wait();
        return this.g;
      }
      run() {
        if (!this.g) {
          this.g = $Hh((token) => this.h(token));
        }
        this.d.open();
        return this.g;
      }
      cancel() {
        if (!this.g) {
          this.g = $Hh((token) => {
            return new Promise((c, e) => {
              const disposable = token.onCancellationRequested(() => {
                disposable.dispose();
                e(new $lb());
              });
            });
          });
          this.d.open();
        }
        this.g.cancel();
      }
    };
  }
});

// out-build/vs/platform/extensionManagement/common/extensionsProfileScannerService.js
function isStoredProfileExtension(candidate) {
  return $Bg(candidate) && $oA(candidate.identifier) && (isUriComponents(candidate.location) || $zg(candidate.location) && candidate.location) && ($Gg(candidate.relativeLocation) || $zg(candidate.relativeLocation)) && candidate.version && $zg(candidate.version);
}
function isUriComponents(thing) {
  if (!thing) {
    return false;
  }
  return $zg(thing.path) && $zg(thing.scheme);
}
var ExtensionsProfileScanningErrorCode, $PA, $QA, $RA;
var init_extensionsProfileScannerService = __esm({
  "out-build/vs/platform/extensionManagement/common/extensionsProfileScannerService.js"() {
    "use strict";
    init_async();
    init_buffer();
    init_lifecycle();
    init_event();
    init_map();
    init_uri();
    init_extensionManagement();
    init_extensionManagementUtil();
    init_files();
    init_instantiation();
    init_log();
    init_userDataProfile();
    init_uriIdentity();
    init_types();
    init_errors();
    init_telemetry();
    (function(ExtensionsProfileScanningErrorCode2) {
      ExtensionsProfileScanningErrorCode2["ERROR_PROFILE_NOT_FOUND"] = "ERROR_PROFILE_NOT_FOUND";
      ExtensionsProfileScanningErrorCode2["ERROR_INVALID_CONTENT"] = "ERROR_INVALID_CONTENT";
    })(ExtensionsProfileScanningErrorCode || (ExtensionsProfileScanningErrorCode = {}));
    $PA = class extends Error {
      constructor(message, code) {
        super(message);
        this.code = code;
      }
    };
    $QA = $Qk("IExtensionsProfileScannerService");
    $RA = class $RA2 extends $3c {
      constructor(j, m, n, r, s, t) {
        super();
        this.j = j;
        this.m = m;
        this.n = n;
        this.r = r;
        this.s = s;
        this.t = t;
        this.b = this.B(new $ze());
        this.onAddExtensions = this.b.event;
        this.c = this.B(new $ze());
        this.onDidAddExtensions = this.c.event;
        this.f = this.B(new $ze());
        this.onRemoveExtensions = this.f.event;
        this.g = this.B(new $ze());
        this.onDidRemoveExtensions = this.g.event;
        this.h = new $Ec();
      }
      scanProfileExtensions(profileLocation, options2) {
        return this.u(profileLocation, void 0, options2);
      }
      async addExtensionsToProfile(extensions, profileLocation, keepExistingVersions) {
        const extensionsToRemove = [];
        const extensionsToAdd = [];
        try {
          await this.u(profileLocation, (existingExtensions) => {
            const result = [];
            if (keepExistingVersions) {
              result.push(...existingExtensions);
            } else {
              for (const existing of existingExtensions) {
                if (extensions.some(([e]) => $DA(e.identifier, existing.identifier) && e.manifest.version !== existing.version)) {
                  extensionsToRemove.push(existing);
                } else {
                  result.push(existing);
                }
              }
            }
            for (const [extension, metadata] of extensions) {
              const index = result.findIndex((e) => $DA(e.identifier, extension.identifier) && e.version === extension.manifest.version);
              const extensionToAdd = { identifier: extension.identifier, version: extension.manifest.version, location: extension.location, metadata };
              if (index === -1) {
                extensionsToAdd.push(extensionToAdd);
                result.push(extensionToAdd);
              } else {
                result.splice(index, 1, extensionToAdd);
              }
            }
            if (extensionsToAdd.length) {
              this.b.fire({ extensions: extensionsToAdd, profileLocation });
            }
            if (extensionsToRemove.length) {
              this.f.fire({ extensions: extensionsToRemove, profileLocation });
            }
            return result;
          });
          if (extensionsToAdd.length) {
            this.c.fire({ extensions: extensionsToAdd, profileLocation });
          }
          if (extensionsToRemove.length) {
            this.g.fire({ extensions: extensionsToRemove, profileLocation });
          }
          return extensionsToAdd;
        } catch (error) {
          if (extensionsToAdd.length) {
            this.c.fire({ extensions: extensionsToAdd, error, profileLocation });
          }
          if (extensionsToRemove.length) {
            this.g.fire({ extensions: extensionsToRemove, error, profileLocation });
          }
          throw error;
        }
      }
      async updateMetadata(extensions, profileLocation) {
        const updatedExtensions = [];
        await this.u(profileLocation, (profileExtensions) => {
          const result = [];
          for (const profileExtension of profileExtensions) {
            const extension = extensions.find(([e]) => $DA(e.identifier, profileExtension.identifier) && e.manifest.version === profileExtension.version);
            if (extension) {
              profileExtension.metadata = { ...profileExtension.metadata, ...extension[1] };
              updatedExtensions.push(profileExtension);
              result.push(profileExtension);
            } else {
              result.push(profileExtension);
            }
          }
          return result;
        });
        return updatedExtensions;
      }
      async removeExtensionFromProfile(extension, profileLocation) {
        const extensionsToRemove = [];
        try {
          await this.u(profileLocation, (profileExtensions) => {
            const result = [];
            for (const e of profileExtensions) {
              if ($DA(e.identifier, extension.identifier)) {
                extensionsToRemove.push(e);
              } else {
                result.push(e);
              }
            }
            if (extensionsToRemove.length) {
              this.f.fire({ extensions: extensionsToRemove, profileLocation });
            }
            return result;
          });
          if (extensionsToRemove.length) {
            this.g.fire({ extensions: extensionsToRemove, profileLocation });
          }
        } catch (error) {
          if (extensionsToRemove.length) {
            this.g.fire({ extensions: extensionsToRemove, error, profileLocation });
          }
          throw error;
        }
      }
      async u(file, updateFn, options2) {
        return this.F(file).queue(async () => {
          let extensions = [];
          let storedProfileExtensions;
          try {
            const content = await this.m.readFile(file);
            storedProfileExtensions = JSON.parse(content.value.toString().trim() || "[]");
          } catch (error) {
            if ($Bm(error) !== 1) {
              throw error;
            }
            if (this.r.extUri.isEqual(file, this.n.defaultProfile.extensionsResource)) {
              storedProfileExtensions = await this.D();
            }
            if (!storedProfileExtensions && options2?.bailOutWhenFileNotFound) {
              throw new $PA(
                $qb(error),
                "ERROR_PROFILE_NOT_FOUND"
                /* ExtensionsProfileScanningErrorCode.ERROR_PROFILE_NOT_FOUND */
              );
            }
          }
          if (storedProfileExtensions) {
            if (!Array.isArray(storedProfileExtensions)) {
              this.w(file);
            }
            let migrate = false;
            for (const e of storedProfileExtensions) {
              if (!isStoredProfileExtension(e)) {
                this.w(file);
              }
              let location2;
              if ($zg(e.relativeLocation) && e.relativeLocation) {
                location2 = this.z(e.relativeLocation);
              } else if ($zg(e.location)) {
                this.t.warn(`Extensions profile: Ignoring extension with invalid location: ${e.location}`);
                continue;
              } else {
                location2 = URI.revive(e.location);
                const relativePath = this.y(location2);
                if (relativePath) {
                  migrate = true;
                  e.relativeLocation = relativePath;
                }
              }
              if ($Gg(e.metadata?.hasPreReleaseVersion) && e.metadata?.preRelease) {
                migrate = true;
                e.metadata.hasPreReleaseVersion = true;
              }
              extensions.push({
                identifier: e.identifier,
                location: location2,
                version: e.version,
                metadata: e.metadata
              });
            }
            if (migrate) {
              await this.m.writeFile(file, $Ci.fromString(JSON.stringify(storedProfileExtensions)));
            }
          }
          if (updateFn) {
            extensions = updateFn(extensions);
            const storedProfileExtensions2 = extensions.map((e) => ({
              identifier: e.identifier,
              version: e.version,
              // retain old format so that old clients can read it
              location: e.location.toJSON(),
              relativeLocation: this.y(e.location),
              metadata: e.metadata
            }));
            await this.m.writeFile(file, $Ci.fromString(JSON.stringify(storedProfileExtensions2)));
          }
          return extensions;
        });
      }
      w(file) {
        const error = new $PA(
          `Invalid extensions content in ${file.toString()}`,
          "ERROR_INVALID_CONTENT"
          /* ExtensionsProfileScanningErrorCode.ERROR_INVALID_CONTENT */
        );
        this.s.publicLogError2("extensionsProfileScanningError", { code: error.code });
        throw error;
      }
      y(extensionLocation) {
        return this.r.extUri.isEqual(this.r.extUri.dirname(extensionLocation), this.j) ? this.r.extUri.basename(extensionLocation) : void 0;
      }
      z(path7) {
        return this.r.extUri.joinPath(this.j, path7);
      }
      async D() {
        if (!this.C) {
          this.C = (async () => {
            const oldDefaultProfileExtensionsLocation = this.r.extUri.joinPath(this.n.defaultProfile.location, "extensions.json");
            const oldDefaultProfileExtensionsInitLocation = this.r.extUri.joinPath(this.j, ".init-default-profile-extensions");
            let content;
            try {
              content = (await this.m.readFile(oldDefaultProfileExtensionsLocation)).value.toString();
            } catch (error) {
              if ($Bm(error) === 1) {
                return void 0;
              }
              throw error;
            }
            this.t.info("Migrating extensions from old default profile location", oldDefaultProfileExtensionsLocation.toString());
            let storedProfileExtensions;
            try {
              const parsedData = JSON.parse(content);
              if (Array.isArray(parsedData) && parsedData.every((candidate) => isStoredProfileExtension(candidate))) {
                storedProfileExtensions = parsedData;
              } else {
                this.t.warn("Skipping migrating from old default profile locaiton: Found invalid data", parsedData);
              }
            } catch (error) {
              this.t.error(error);
            }
            if (storedProfileExtensions) {
              try {
                await this.m.createFile(this.n.defaultProfile.extensionsResource, $Ci.fromString(JSON.stringify(storedProfileExtensions)), { overwrite: false });
                this.t.info("Migrated extensions from old default profile location to new location", oldDefaultProfileExtensionsLocation.toString(), this.n.defaultProfile.extensionsResource.toString());
              } catch (error) {
                if ($Bm(error) === 3) {
                  this.t.info("Migration from old default profile location to new location is done by another window", oldDefaultProfileExtensionsLocation.toString(), this.n.defaultProfile.extensionsResource.toString());
                } else {
                  throw error;
                }
              }
            }
            try {
              await this.m.del(oldDefaultProfileExtensionsLocation);
            } catch (error) {
              if ($Bm(error) !== 1) {
                this.t.error(error);
              }
            }
            try {
              await this.m.del(oldDefaultProfileExtensionsInitLocation);
            } catch (error) {
              if ($Bm(error) !== 1) {
                this.t.error(error);
              }
            }
            return storedProfileExtensions;
          })();
        }
        return this.C;
      }
      F(file) {
        let resourceQueue = this.h.get(file);
        if (!resourceQueue) {
          resourceQueue = new $3h();
          this.h.set(file, resourceQueue);
        }
        return resourceQueue;
      }
    };
    $RA = __decorate([
      __param(1, $km),
      __param(2, $rs),
      __param(3, $vl),
      __param(4, $zv),
      __param(5, $wn)
    ], $RA);
  }
});

// out-build/vs/base/common/jsonErrorMessages.js
function $SA(errorCode) {
  switch (errorCode) {
    case 1:
      return localize(116, null);
    case 2:
      return localize(117, null);
    case 3:
      return localize(118, null);
    case 4:
      return localize(119, null);
    case 5:
      return localize(120, null);
    case 6:
      return localize(121, null);
    case 7:
      return localize(122, null);
    case 8:
      return localize(123, null);
    case 9:
      return localize(124, null);
    default:
      return "";
  }
}
var init_jsonErrorMessages = __esm({
  "out-build/vs/base/common/jsonErrorMessages.js"() {
    "use strict";
    init_nls2();
  }
});

// out-build/vs/platform/extensionManagement/common/extensionNls.js
function $3A(logger, extensionManifest, translations, fallbackTranslations) {
  try {
    replaceNLStrings(logger, extensionManifest, translations, fallbackTranslations);
  } catch (error) {
    logger.error(error?.message ?? error);
  }
  return extensionManifest;
}
function replaceNLStrings(logger, extensionManifest, messages, originalMessages) {
  const processEntry = (obj, key, command) => {
    const value = obj[key];
    if ($zg(value)) {
      const str = value;
      const length = str.length;
      if (length > 1 && str[0] === "%" && str[length - 1] === "%") {
        const messageKey = str.substr(1, length - 2);
        let translated = messages[messageKey];
        if (translated === void 0 && originalMessages) {
          translated = originalMessages[messageKey];
        }
        const message = typeof translated === "string" ? translated : translated?.message;
        const original = originalMessages?.[messageKey];
        const originalMessage = typeof original === "string" ? original : original?.message;
        if (!message) {
          if (!originalMessage) {
            logger.warn(`[${extensionManifest.name}]: ${localize(1854, null, messageKey)}`);
          }
          return;
        }
        if (
          // if we are translating the title or category of a command
          command && (key === "title" || key === "category") && // and the original value is not the same as the translated value
          originalMessage && originalMessage !== message
        ) {
          const localizedString = {
            value: message,
            original: originalMessage
          };
          obj[key] = localizedString;
        } else {
          obj[key] = message;
        }
      }
    } else if ($Bg(value)) {
      for (const k in value) {
        if (value.hasOwnProperty(k)) {
          k === "commands" ? processEntry(value, k, true) : processEntry(value, k, command);
        }
      }
    } else if (Array.isArray(value)) {
      for (let i = 0; i < value.length; i++) {
        processEntry(value, i, command);
      }
    }
  };
  for (const key in extensionManifest) {
    if (extensionManifest.hasOwnProperty(key)) {
      processEntry(extensionManifest, key);
    }
  }
}
var init_extensionNls = __esm({
  "out-build/vs/platform/extensionManagement/common/extensionNls.js"() {
    "use strict";
    init_types();
    init_nls2();
  }
});

// out-build/vs/platform/extensionManagement/common/extensionsScannerService.js
function $7A(extension, isUnderDevelopment) {
  const id2 = $GA(extension.manifest.publisher, extension.manifest.name);
  return {
    id: id2,
    identifier: new $5z(id2),
    isBuiltin: extension.type === 0,
    isUserBuiltin: extension.type === 1 && extension.isBuiltin,
    isUnderDevelopment,
    extensionLocation: extension.location,
    uuid: extension.identifier.uuid,
    targetPlatform: extension.targetPlatform,
    publisherDisplayName: extension.publisherDisplayName,
    preRelease: extension.preRelease,
    ...extension.manifest
  };
}
var Translations, $4A, $5A, $6A, ExtensionsScanner, CachedExtensionsScanner;
var init_extensionsScannerService = __esm({
  "out-build/vs/platform/extensionManagement/common/extensionsScannerService.js"() {
    "use strict";
    init_arrays();
    init_async();
    init_objects();
    init_buffer();
    init_errors();
    init_json();
    init_jsonErrorMessages();
    init_lifecycle();
    init_network();
    init_path();
    init_platform();
    init_resources();
    init_semver();
    init_severity();
    init_types();
    init_uri();
    init_nls2();
    init_environment();
    init_extensionManagementUtil();
    init_extensions();
    init_extensionValidator();
    init_files();
    init_instantiation();
    init_log();
    init_productService();
    init_event();
    init_marshalling();
    init_extensionsProfileScannerService();
    init_userDataProfile();
    init_uriIdentity();
    init_extensionNls();
    (function(Translations2) {
      function equals(a, b) {
        if (a === b) {
          return true;
        }
        const aKeys = Object.keys(a);
        const bKeys = /* @__PURE__ */ new Set();
        for (const key of Object.keys(b)) {
          bKeys.add(key);
        }
        if (aKeys.length !== bKeys.size) {
          return false;
        }
        for (const key of aKeys) {
          if (a[key] !== b[key]) {
            return false;
          }
          bKeys.delete(key);
        }
        return bKeys.size === 0;
      }
      Translations2.equals = equals;
    })(Translations || (Translations = {}));
    $4A = $Qk("IExtensionsScannerService");
    $5A = class $5A2 extends $3c {
      constructor(systemExtensionsLocation, userExtensionsLocation, r, s, t, u, w, y, z, C, D, F) {
        super();
        this.systemExtensionsLocation = systemExtensionsLocation;
        this.userExtensionsLocation = userExtensionsLocation;
        this.r = r;
        this.s = s;
        this.t = t;
        this.u = u;
        this.w = w;
        this.y = y;
        this.z = z;
        this.C = C;
        this.D = D;
        this.F = F;
        this.g = this.B(new $ze());
        this.onDidChangeCache = this.g.event;
        this.h = $vh(this.userExtensionsLocation, ".obsolete");
        this.j = this.B(this.F.createInstance(CachedExtensionsScanner, this.s, this.h));
        this.m = this.B(this.F.createInstance(CachedExtensionsScanner, this.s, this.h));
        this.n = this.B(this.F.createInstance(ExtensionsScanner, this.h));
        this.H = void 0;
        this.B(this.j.onDidChangeCache(() => this.g.fire(
          0
          /* ExtensionType.System */
        )));
        this.B(this.m.onDidChangeCache(() => this.g.fire(
          1
          /* ExtensionType.User */
        )));
      }
      getTargetPlatform() {
        if (!this.G) {
          this.G = $OA(this.w, this.y);
        }
        return this.G;
      }
      async scanAllExtensions(systemScanOptions, userScanOptions, includeExtensionsUnderDev) {
        const [system, user] = await Promise.all([
          this.scanSystemExtensions(systemScanOptions),
          this.scanUserExtensions(userScanOptions)
        ]);
        const development = includeExtensionsUnderDev ? await this.scanExtensionsUnderDevelopment(systemScanOptions, [...system, ...user]) : [];
        return this.L(system, user, development, await this.getTargetPlatform(), true);
      }
      async scanSystemExtensions(scanOptions) {
        const promises15 = [];
        promises15.push(this.M(!!scanOptions.useCache, scanOptions.language));
        promises15.push(this.N(scanOptions.language, !!scanOptions.checkControlFile));
        const [defaultSystemExtensions, devSystemExtensions] = await Promise.all(promises15);
        return this.J([...defaultSystemExtensions, ...devSystemExtensions], 0, scanOptions, false);
      }
      async scanUserExtensions(scanOptions) {
        const location2 = scanOptions.profileLocation ?? this.userExtensionsLocation;
        this.y.trace("Started scanning user extensions", location2);
        const profileScanOptions = this.D.extUri.isEqual(scanOptions.profileLocation, this.t.defaultProfile.extensionsResource) ? { bailOutWhenFileNotFound: true } : void 0;
        const extensionsScannerInput = await this.P(location2, !!scanOptions.profileLocation, 1, !scanOptions.includeUninstalled, scanOptions.language, true, profileScanOptions, scanOptions.productVersion ?? this.R());
        const extensionsScanner = scanOptions.useCache && !extensionsScannerInput.devMode && extensionsScannerInput.excludeObsolete ? this.m : this.n;
        let extensions;
        try {
          extensions = await extensionsScanner.scanExtensions(extensionsScannerInput);
        } catch (error) {
          if (error instanceof $PA && error.code === "ERROR_PROFILE_NOT_FOUND") {
            await this.I();
            extensions = await extensionsScanner.scanExtensions(extensionsScannerInput);
          } else {
            throw error;
          }
        }
        extensions = await this.J(extensions, 1, scanOptions, true);
        this.y.trace("Scanned user extensions:", extensions.length);
        return extensions;
      }
      async scanExtensionsUnderDevelopment(scanOptions, existingExtensions) {
        if (this.z.isExtensionDevelopment && this.z.extensionDevelopmentLocationURI) {
          const extensions = (await Promise.all(this.z.extensionDevelopmentLocationURI.filter((extLoc) => extLoc.scheme === Schemas.file).map(async (extensionDevelopmentLocationURI) => {
            const input = await this.P(extensionDevelopmentLocationURI, false, 1, true, scanOptions.language, false, void 0, scanOptions.productVersion ?? this.R());
            const extensions2 = await this.n.scanOneOrMultipleExtensions(input);
            return extensions2.map((extension) => {
              extension.type = existingExtensions.find((e) => $DA(e.identifier, extension.identifier))?.type ?? extension.type;
              return this.n.validate(extension, input);
            });
          }))).flat();
          return this.J(extensions, "development", scanOptions, true);
        }
        return [];
      }
      async scanExistingExtension(extensionLocation, extensionType, scanOptions) {
        const extensionsScannerInput = await this.P(extensionLocation, false, extensionType, true, scanOptions.language, true, void 0, scanOptions.productVersion ?? this.R());
        const extension = await this.n.scanExtension(extensionsScannerInput);
        if (!extension) {
          return null;
        }
        if (!scanOptions.includeInvalid && !extension.isValid) {
          return null;
        }
        return extension;
      }
      async scanOneOrMultipleExtensions(extensionLocation, extensionType, scanOptions) {
        const extensionsScannerInput = await this.P(extensionLocation, false, extensionType, true, scanOptions.language, true, void 0, scanOptions.productVersion ?? this.R());
        const extensions = await this.n.scanOneOrMultipleExtensions(extensionsScannerInput);
        return this.J(extensions, extensionType, scanOptions, true);
      }
      async scanMultipleExtensions(extensionLocations, extensionType, scanOptions) {
        const extensions = [];
        await Promise.all(extensionLocations.map(async (extensionLocation) => {
          const scannedExtensions = await this.scanOneOrMultipleExtensions(extensionLocation, extensionType, scanOptions);
          extensions.push(...scannedExtensions);
        }));
        return this.J(extensions, extensionType, scanOptions, true);
      }
      async scanMetadata(extensionLocation) {
        const manifestLocation = $vh(extensionLocation, "package.json");
        const content = (await this.w.readFile(manifestLocation)).value.toString();
        const manifest = JSON.parse(content);
        return manifest.__metadata;
      }
      async updateMetadata(extensionLocation, metaData) {
        const manifestLocation = $vh(extensionLocation, "package.json");
        const content = (await this.w.readFile(manifestLocation)).value.toString();
        const manifest = JSON.parse(content);
        if (metaData.isMachineScoped === false) {
          delete metaData.isMachineScoped;
        }
        if (metaData.isBuiltin === false) {
          delete metaData.isBuiltin;
        }
        manifest.__metadata = { ...manifest.__metadata, ...metaData };
        await this.w.writeFile($vh(extensionLocation, "package.json"), $Ci.fromString(JSON.stringify(manifest, null, "	")));
      }
      async initializeDefaultProfileExtensions() {
        try {
          await this.u.scanProfileExtensions(this.t.defaultProfile.extensionsResource, { bailOutWhenFileNotFound: true });
        } catch (error) {
          if (error instanceof $PA && error.code === "ERROR_PROFILE_NOT_FOUND") {
            await this.I();
          } else {
            throw error;
          }
        }
      }
      async I() {
        if (!this.H) {
          this.H = (async () => {
            try {
              this.y.info("Started initializing default profile extensions in extensions installation folder.", this.userExtensionsLocation.toString());
              const userExtensions = await this.scanUserExtensions({ includeInvalid: true });
              if (userExtensions.length) {
                await this.u.addExtensionsToProfile(userExtensions.map((e) => [e, e.metadata]), this.t.defaultProfile.extensionsResource);
              } else {
                try {
                  await this.w.createFile(this.t.defaultProfile.extensionsResource, $Ci.fromString(JSON.stringify([])));
                } catch (error) {
                  if ($Bm(error) !== 1) {
                    this.y.warn("Failed to create default profile extensions manifest in extensions installation folder.", this.userExtensionsLocation.toString(), $qb(error));
                  }
                }
              }
              this.y.info("Completed initializing default profile extensions in extensions installation folder.", this.userExtensionsLocation.toString());
            } catch (error) {
              this.y.error(error);
            } finally {
              this.H = void 0;
            }
          })();
        }
        return this.H;
      }
      async J(extensions, type2, scanOptions, pickLatest) {
        if (!scanOptions.includeAllVersions) {
          extensions = this.L(type2 === 0 ? extensions : void 0, type2 === 1 ? extensions : void 0, type2 === "development" ? extensions : void 0, await this.getTargetPlatform(), pickLatest);
        }
        if (!scanOptions.includeInvalid) {
          extensions = extensions.filter((extension) => extension.isValid);
        }
        return extensions.sort((a, b) => {
          const aLastSegment = $rc(a.location.fsPath);
          const bLastSegment = $rc(b.location.fsPath);
          if (aLastSegment < bLastSegment) {
            return -1;
          }
          if (aLastSegment > bLastSegment) {
            return 1;
          }
          return 0;
        });
      }
      L(system, user, development, targetPlatform, pickLatest) {
        const pick = (existing, extension, isDevelopment) => {
          if (existing.isValid && !extension.isValid) {
            return false;
          }
          if (existing.isValid === extension.isValid) {
            if (pickLatest && gt(existing.manifest.version, extension.manifest.version)) {
              this.y.debug(`Skipping extension ${extension.location.path} with lower version ${extension.manifest.version} in favour of ${existing.location.path} with version ${existing.manifest.version}`);
              return false;
            }
            if (eq(existing.manifest.version, extension.manifest.version)) {
              if (existing.type === 0) {
                this.y.debug(`Skipping extension ${extension.location.path} in favour of system extension ${existing.location.path} with same version`);
                return false;
              }
              if (existing.targetPlatform === targetPlatform) {
                this.y.debug(`Skipping extension ${extension.location.path} from different target platform ${extension.targetPlatform}`);
                return false;
              }
            }
          }
          if (isDevelopment) {
            this.y.warn(`Overwriting user extension ${existing.location.path} with ${extension.location.path}.`);
          } else {
            this.y.debug(`Overwriting user extension ${existing.location.path} with ${extension.location.path}.`);
          }
          return true;
        };
        const result = new $7z();
        system?.forEach((extension) => {
          const existing = result.get(extension.identifier.id);
          if (!existing || pick(existing, extension, false)) {
            result.set(extension.identifier.id, extension);
          }
        });
        user?.forEach((extension) => {
          const existing = result.get(extension.identifier.id);
          if (!existing && system && extension.type === 0) {
            this.y.debug(`Skipping obsolete system extension ${extension.location.path}.`);
            return;
          }
          if (!existing || pick(existing, extension, false)) {
            result.set(extension.identifier.id, extension);
          }
        });
        development?.forEach((extension) => {
          const existing = result.get(extension.identifier.id);
          if (!existing || pick(existing, extension, true)) {
            result.set(extension.identifier.id, extension);
          }
          result.set(extension.identifier.id, extension);
        });
        return [...result.values()];
      }
      async M(useCache, language) {
        this.y.trace("Started scanning system extensions");
        const extensionsScannerInput = await this.P(this.systemExtensionsLocation, false, 0, true, language, true, void 0, this.R());
        const extensionsScanner = useCache && !extensionsScannerInput.devMode ? this.j : this.n;
        const result = await extensionsScanner.scanExtensions(extensionsScannerInput);
        this.y.trace("Scanned system extensions:", result.length);
        return result;
      }
      async N(language, checkControlFile) {
        const devSystemExtensionsList = this.z.isBuilt ? [] : this.C.builtInExtensions;
        if (!devSystemExtensionsList?.length) {
          return [];
        }
        this.y.trace("Started scanning dev system extensions");
        const builtinExtensionControl = checkControlFile ? await this.O() : {};
        const devSystemExtensionsLocations = [];
        const devSystemExtensionsLocation = URI.file($lc($nc($ih.asFileUri("").fsPath, "..", ".build", "builtInExtensions")));
        for (const extension of devSystemExtensionsList) {
          const controlState = builtinExtensionControl[extension.name] || "marketplace";
          switch (controlState) {
            case "disabled":
              break;
            case "marketplace":
              devSystemExtensionsLocations.push($vh(devSystemExtensionsLocation, extension.name));
              break;
            default:
              devSystemExtensionsLocations.push(URI.file(controlState));
              break;
          }
        }
        const result = await Promise.all(devSystemExtensionsLocations.map(async (location2) => this.n.scanExtension(await this.P(location2, false, 0, true, language, true, void 0, this.R()))));
        this.y.trace("Scanned dev system extensions:", result.length);
        return $Mb(result);
      }
      async O() {
        try {
          const content = await this.w.readFile(this.r);
          return JSON.parse(content.value.toString());
        } catch (error) {
          return {};
        }
      }
      async P(location2, profile, type2, excludeObsolete, language, validate, profileScanOptions, productVersion) {
        const translations = await this.f(language ?? $z);
        const mtime = await this.Q(location2);
        const applicationExtensionsLocation = profile && !this.D.extUri.isEqual(location2, this.t.defaultProfile.extensionsResource) ? this.t.defaultProfile.extensionsResource : void 0;
        const applicationExtensionsLocationMtime = applicationExtensionsLocation ? await this.Q(applicationExtensionsLocation) : void 0;
        return new $6A(location2, mtime, applicationExtensionsLocation, applicationExtensionsLocationMtime, profile, profileScanOptions, type2, excludeObsolete, validate, productVersion.version, productVersion.date, this.C.commit, !this.z.isBuilt, language, translations);
      }
      async Q(location2) {
        try {
          const stat = await this.w.stat(location2);
          if (typeof stat.mtime === "number") {
            return stat.mtime;
          }
        } catch (err) {
        }
        return void 0;
      }
      R() {
        return {
          version: this.C.version,
          date: this.C.date
        };
      }
    };
    $5A = __decorate([
      __param(4, $rs),
      __param(5, $QA),
      __param(6, $km),
      __param(7, $wn),
      __param(8, $Xk),
      __param(9, $Vu),
      __param(10, $vl),
      __param(11, $Pk)
    ], $5A);
    $6A = class {
      constructor(location2, mtime, applicationExtensionslocation, applicationExtensionslocationMtime, profile, profileScanOptions, type2, excludeObsolete, validate, productVersion, productDate, productCommit, devMode, language, translations) {
        this.location = location2;
        this.mtime = mtime;
        this.applicationExtensionslocation = applicationExtensionslocation;
        this.applicationExtensionslocationMtime = applicationExtensionslocationMtime;
        this.profile = profile;
        this.profileScanOptions = profileScanOptions;
        this.type = type2;
        this.excludeObsolete = excludeObsolete;
        this.validate = validate;
        this.productVersion = productVersion;
        this.productDate = productDate;
        this.productCommit = productCommit;
        this.devMode = devMode;
        this.language = language;
        this.translations = translations;
      }
      static createNlsConfiguration(input) {
        return {
          language: input.language,
          pseudo: input.language === "pseudo",
          devMode: input.devMode,
          translations: input.translations
        };
      }
      static equals(a, b) {
        return $oh(a.location, b.location) && a.mtime === b.mtime && $oh(a.applicationExtensionslocation, b.applicationExtensionslocation) && a.applicationExtensionslocationMtime === b.applicationExtensionslocationMtime && a.profile === b.profile && $Pv(a.profileScanOptions, b.profileScanOptions) && a.type === b.type && a.excludeObsolete === b.excludeObsolete && a.validate === b.validate && a.productVersion === b.productVersion && a.productDate === b.productDate && a.productCommit === b.productCommit && a.devMode === b.devMode && a.language === b.language && Translations.equals(a.translations, b.translations);
      }
    };
    ExtensionsScanner = class ExtensionsScanner2 extends $3c {
      constructor(g, h, j, m, productService, n, r) {
        super();
        this.g = g;
        this.h = h;
        this.j = j;
        this.m = m;
        this.n = n;
        this.r = r;
        this.f = productService.extensionsEnabledWithApiProposalVersion?.map((id2) => id2.toLowerCase()) ?? [];
      }
      async scanExtensions(input) {
        const extensions = input.profile ? await this.t(input) : await this.s(input);
        let obsolete = {};
        if (input.excludeObsolete && input.type === 1) {
          try {
            const raw = (await this.m.readFile(this.g)).value.toString();
            obsolete = JSON.parse(raw);
          } catch (error) {
          }
        }
        return $Mg(obsolete) ? extensions : extensions.filter((e) => !obsolete[$EA.create(e).toString()]);
      }
      async s(input) {
        const stat = await this.m.resolve(input.location);
        if (!stat.children?.length) {
          return [];
        }
        const extensions = await Promise.all(stat.children.map(async (c) => {
          if (!c.isDirectory) {
            return null;
          }
          if (input.type === 1 && $sh(c.resource).indexOf(".") === 0) {
            return null;
          }
          const extensionScannerInput = new $6A(c.resource, input.mtime, input.applicationExtensionslocation, input.applicationExtensionslocationMtime, input.profile, input.profileScanOptions, input.type, input.excludeObsolete, input.validate, input.productVersion, input.productDate, input.productCommit, input.devMode, input.language, input.translations);
          return this.scanExtension(extensionScannerInput);
        }));
        return $Mb(extensions).sort((a, b) => a.location.path < b.location.path ? -1 : 1);
      }
      async t(input) {
        let profileExtensions = await this.u(input.location, () => true, input);
        if (input.applicationExtensionslocation && !this.j.extUri.isEqual(input.location, input.applicationExtensionslocation)) {
          profileExtensions = profileExtensions.filter((e) => !e.metadata?.isApplicationScoped);
          const applicationExtensions = await this.u(input.applicationExtensionslocation, (e) => !!e.metadata?.isBuiltin || !!e.metadata?.isApplicationScoped, input);
          profileExtensions.push(...applicationExtensions);
        }
        return profileExtensions;
      }
      async u(profileResource, filter, input) {
        const scannedProfileExtensions = await this.h.scanProfileExtensions(profileResource, input.profileScanOptions);
        if (!scannedProfileExtensions.length) {
          return [];
        }
        const extensions = await Promise.all(scannedProfileExtensions.map(async (extensionInfo) => {
          if (filter(extensionInfo)) {
            const extensionScannerInput = new $6A(extensionInfo.location, input.mtime, input.applicationExtensionslocation, input.applicationExtensionslocationMtime, input.profile, input.profileScanOptions, input.type, input.excludeObsolete, input.validate, input.productVersion, input.productDate, input.productCommit, input.devMode, input.language, input.translations);
            return this.scanExtension(extensionScannerInput, extensionInfo.metadata);
          }
          return null;
        }));
        return $Mb(extensions);
      }
      async scanOneOrMultipleExtensions(input) {
        try {
          if (await this.m.exists($vh(input.location, "package.json"))) {
            const extension = await this.scanExtension(input);
            return extension ? [extension] : [];
          } else {
            return await this.scanExtensions(input);
          }
        } catch (error) {
          this.r.error(`Error scanning extensions at ${input.location.path}:`, $qb(error));
          return [];
        }
      }
      async scanExtension(input, metadata) {
        try {
          let manifest = await this.w(input.location);
          if (manifest) {
            if (!manifest.publisher) {
              manifest.publisher = $1z;
            }
            metadata = metadata ?? manifest.__metadata;
            if (metadata && !metadata?.size && manifest.__metadata?.size) {
              metadata.size = manifest.__metadata?.size;
            }
            delete manifest.__metadata;
            const id2 = $IA(manifest.publisher, manifest.name);
            const identifier = metadata?.id ? { id: id2, uuid: metadata.id } : { id: id2 };
            const type2 = metadata?.isSystem ? 0 : input.type;
            const isBuiltin = type2 === 0 || !!metadata?.isBuiltin;
            manifest = await this.y(input.location, manifest, $6A.createNlsConfiguration(input));
            let extension = {
              type: type2,
              identifier,
              manifest,
              location: input.location,
              isBuiltin,
              targetPlatform: metadata?.targetPlatform ?? "undefined",
              publisherDisplayName: metadata?.publisherDisplayName,
              metadata,
              isValid: true,
              validations: [],
              preRelease: !!metadata?.preRelease
            };
            if (input.validate) {
              extension = this.validate(extension, input);
            }
            if (manifest.enabledApiProposals && (!this.n.isBuilt || this.f.includes(id2.toLowerCase()))) {
              manifest.originalEnabledApiProposals = manifest.enabledApiProposals;
              manifest.enabledApiProposals = $aA([...manifest.enabledApiProposals]);
            }
            return extension;
          }
        } catch (e) {
          if (input.type !== 0) {
            this.r.error(e);
          }
        }
        return null;
      }
      validate(extension, input) {
        let isValid = true;
        const validateApiVersion = this.n.isBuilt && this.f.includes(extension.identifier.id.toLowerCase());
        const validations = $YA(input.productVersion, input.productDate, input.location, extension.manifest, extension.isBuiltin, validateApiVersion);
        for (const [severity, message] of validations) {
          if (severity === severity_default.Error) {
            isValid = false;
            this.r.error(this.F(input.location, message));
          }
        }
        extension.isValid = isValid;
        extension.validations = validations;
        return extension;
      }
      async w(extensionLocation) {
        const manifestLocation = $vh(extensionLocation, "package.json");
        let content;
        try {
          content = (await this.m.readFile(manifestLocation)).value.toString();
        } catch (error) {
          if ($Bm(error) !== 1) {
            this.r.error(this.F(extensionLocation, localize(1855, null, manifestLocation.path, error.message)));
          }
          return null;
        }
        let manifest;
        try {
          manifest = JSON.parse(content);
        } catch (err) {
          const errors = [];
          $yw(content, errors);
          for (const e of errors) {
            this.r.error(this.F(extensionLocation, localize(1856, null, manifestLocation.path, e.offset, e.length, $SA(e.error))));
          }
          return null;
        }
        if ($Gw(manifest) !== "object") {
          this.r.error(this.F(extensionLocation, localize(1857, null, manifestLocation.path)));
          return null;
        }
        return manifest;
      }
      async y(extensionLocation, extensionManifest, nlsConfiguration2) {
        const localizedMessages = await this.z(extensionLocation, extensionManifest, nlsConfiguration2);
        if (localizedMessages) {
          try {
            const errors = [];
            const defaults = await this.C(localizedMessages.default, errors);
            if (errors.length > 0) {
              errors.forEach((error) => {
                this.r.error(this.F(extensionLocation, localize(1858, null, localizedMessages.default?.path, $SA(error.error))));
              });
              return extensionManifest;
            } else if ($Gw(localizedMessages) !== "object") {
              this.r.error(this.F(extensionLocation, localize(1859, null, localizedMessages.default?.path)));
              return extensionManifest;
            }
            const localized = localizedMessages.values || /* @__PURE__ */ Object.create(null);
            return $3A(this.r, extensionManifest, localized, defaults);
          } catch (error) {
          }
        }
        return extensionManifest;
      }
      async z(extensionLocation, extensionManifest, nlsConfiguration2) {
        const defaultPackageNLS = $vh(extensionLocation, "package.nls.json");
        const reportErrors = (localized, errors) => {
          errors.forEach((error) => {
            this.r.error(this.F(extensionLocation, localize(1860, null, localized?.path, $SA(error.error))));
          });
        };
        const reportInvalidFormat = (localized) => {
          this.r.error(this.F(extensionLocation, localize(1861, null, localized?.path)));
        };
        const translationId = `${extensionManifest.publisher}.${extensionManifest.name}`;
        const translationPath = nlsConfiguration2.translations[translationId];
        if (translationPath) {
          try {
            const translationResource = URI.file(translationPath);
            const content = (await this.m.readFile(translationResource)).value.toString();
            const errors = [];
            const translationBundle = $yw(content, errors);
            if (errors.length > 0) {
              reportErrors(translationResource, errors);
              return { values: void 0, default: defaultPackageNLS };
            } else if ($Gw(translationBundle) !== "object") {
              reportInvalidFormat(translationResource);
              return { values: void 0, default: defaultPackageNLS };
            } else {
              const values = translationBundle.contents ? translationBundle.contents.package : void 0;
              return { values, default: defaultPackageNLS };
            }
          } catch (error) {
            return { values: void 0, default: defaultPackageNLS };
          }
        } else {
          const exists2 = await this.m.exists(defaultPackageNLS);
          if (!exists2) {
            return void 0;
          }
          let messageBundle;
          try {
            messageBundle = await this.D(extensionLocation, nlsConfiguration2);
          } catch (error) {
            return void 0;
          }
          if (!messageBundle.localized) {
            return { values: void 0, default: messageBundle.original };
          }
          try {
            const messageBundleContent = (await this.m.readFile(messageBundle.localized)).value.toString();
            const errors = [];
            const messages = $yw(messageBundleContent, errors);
            if (errors.length > 0) {
              reportErrors(messageBundle.localized, errors);
              return { values: void 0, default: messageBundle.original };
            } else if ($Gw(messages) !== "object") {
              reportInvalidFormat(messageBundle.localized);
              return { values: void 0, default: messageBundle.original };
            }
            return { values: messages, default: messageBundle.original };
          } catch (error) {
            return { values: void 0, default: messageBundle.original };
          }
        }
      }
      /**
       * Parses original message bundle, returns null if the original message bundle is null.
       */
      async C(originalMessageBundle, errors) {
        if (originalMessageBundle) {
          try {
            const originalBundleContent = (await this.m.readFile(originalMessageBundle)).value.toString();
            return $yw(originalBundleContent, errors);
          } catch (error) {
          }
        }
        return;
      }
      /**
       * Finds localized message bundle and the original (unlocalized) one.
       * If the localized file is not present, returns null for the original and marks original as localized.
       */
      D(extensionLocation, nlsConfiguration2) {
        return new Promise((c, e) => {
          const loop = (locale) => {
            const toCheck = $vh(extensionLocation, `package.nls.${locale}.json`);
            this.m.exists(toCheck).then((exists2) => {
              if (exists2) {
                c({ localized: toCheck, original: $vh(extensionLocation, "package.nls.json") });
              }
              const index = locale.lastIndexOf("-");
              if (index === -1) {
                c({ localized: $vh(extensionLocation, "package.nls.json"), original: null });
              } else {
                locale = locale.substring(0, index);
                loop(locale);
              }
            });
          };
          if (nlsConfiguration2.devMode || nlsConfiguration2.pseudo || !nlsConfiguration2.language) {
            return c({ localized: $vh(extensionLocation, "package.nls.json"), original: null });
          }
          loop(nlsConfiguration2.language);
        });
      }
      F(extensionLocation, message) {
        return `[${extensionLocation.path}]: ${message}`;
      }
    };
    ExtensionsScanner = __decorate([
      __param(1, $QA),
      __param(2, $vl),
      __param(3, $km),
      __param(4, $Vu),
      __param(5, $Xk),
      __param(6, $wn)
    ], ExtensionsScanner);
    CachedExtensionsScanner = class CachedExtensionsScanner2 extends ExtensionsScanner {
      constructor(J, obsoleteFile, L, extensionsProfileScannerService, uriIdentityService, fileService, productService, environmentService, logService) {
        super(obsoleteFile, extensionsProfileScannerService, uriIdentityService, fileService, productService, environmentService, logService);
        this.J = J;
        this.L = L;
        this.H = this.B(new $Th(3e3));
        this.I = this.B(new $ze());
        this.onDidChangeCache = this.I.event;
      }
      async scanExtensions(input) {
        const cacheFile = this.P(input);
        const cacheContents = await this.M(cacheFile);
        this.G = input;
        if (cacheContents && cacheContents.input && $6A.equals(cacheContents.input, this.G)) {
          this.r.debug("Using cached extensions scan result", input.type === 0 ? "system" : "user", input.location.toString());
          this.H.trigger(() => this.O());
          return cacheContents.result.map((extension) => {
            extension.location = URI.revive(extension.location);
            return extension;
          });
        }
        const result = await super.scanExtensions(input);
        await this.N(cacheFile, { input, result });
        return result;
      }
      async M(cacheFile) {
        try {
          const cacheRawContents = await this.m.readFile(cacheFile);
          const extensionCacheData = JSON.parse(cacheRawContents.value.toString());
          return { result: extensionCacheData.result, input: $cu(extensionCacheData.input) };
        } catch (error) {
          this.r.debug("Error while reading the extension cache file:", cacheFile.path, $qb(error));
        }
        return null;
      }
      async N(cacheFile, cacheContents) {
        try {
          await this.m.writeFile(cacheFile, $Ci.fromString(JSON.stringify(cacheContents)));
        } catch (error) {
          this.r.debug("Error while writing the extension cache file:", cacheFile.path, $qb(error));
        }
      }
      async O() {
        if (!this.G) {
          return;
        }
        const cacheFile = this.P(this.G);
        const cacheContents = await this.M(cacheFile);
        if (!cacheContents) {
          return;
        }
        const actual = cacheContents.result;
        const expected = JSON.parse(JSON.stringify(await super.scanExtensions(this.G)));
        if ($Pv(expected, actual)) {
          return;
        }
        try {
          this.r.info("Invalidating Cache", actual, expected);
          await this.m.del(cacheFile);
          this.I.fire();
        } catch (error) {
          this.r.error(error);
        }
      }
      P(input) {
        const profile = this.Q(input);
        return this.j.extUri.joinPath(profile.cacheHome, input.type === 0 ? $Zz : $Yz);
      }
      Q(input) {
        if (input.type === 0) {
          return this.L.defaultProfile;
        }
        if (!input.profile) {
          return this.L.defaultProfile;
        }
        if (this.j.extUri.isEqual(input.location, this.J.extensionsResource)) {
          return this.J;
        }
        return this.L.profiles.find((p) => this.j.extUri.isEqual(input.location, p.extensionsResource)) ?? this.J;
      }
    };
    CachedExtensionsScanner = __decorate([
      __param(2, $rs),
      __param(3, $QA),
      __param(4, $vl),
      __param(5, $km),
      __param(6, $Vu),
      __param(7, $Xk),
      __param(8, $wn)
    ], CachedExtensionsScanner);
  }
});

// out-build/vs/platform/extensionManagement/node/extensionManagementUtil.js
function $oX(e) {
  let errorCode = "Extract";
  if (e instanceof $kX) {
    if (e.type === "CorruptZip") {
      errorCode = "CorruptZip";
    } else if (e.type === "Incomplete") {
      errorCode = "IncompleteZip";
    }
  }
  return $eX(e, errorCode);
}
async function $pX(vsixPath) {
  let data;
  try {
    data = await $nX(vsixPath, "extension/package.json");
  } catch (e) {
    throw $oX(e);
  }
  try {
    return JSON.parse(data.toString("utf8"));
  } catch (err) {
    throw new $rA(
      localize(1875, null),
      "Invalid"
      /* ExtensionManagementErrorCode.Invalid */
    );
  }
}
var init_extensionManagementUtil2 = __esm({
  "out-build/vs/platform/extensionManagement/node/extensionManagementUtil.js"() {
    "use strict";
    init_zip();
    init_nls2();
    init_abstractExtensionManagementService();
    init_extensionManagement();
  }
});

// out-build/vs/platform/extensionManagement/node/extensionSignatureVerificationService.js
var $_W, $aX;
var init_extensionSignatureVerificationService = __esm({
  "out-build/vs/platform/extensionManagement/node/extensionSignatureVerificationService.js"() {
    "use strict";
    init_errors();
    init_instantiation();
    init_log();
    init_telemetry();
    init_extensionManagement();
    $_W = $Qk("IExtensionSignatureVerificationService");
    $aX = class $aX2 {
      constructor(b, c) {
        this.b = b;
        this.c = c;
      }
      d() {
        if (!this.a) {
          this.a = this.f();
        }
        return this.a;
      }
      async f() {
        const mod = "@vscode/vsce-sign";
        return import(mod);
      }
      async verify(extensionId, version, vsixFilePath, signatureArchiveFilePath, clientTargetPlatform) {
        let module2;
        try {
          module2 = await this.d();
        } catch (error) {
          this.b.error("Could not load vsce-sign module", $qb(error));
          this.b.info(`Extension signature verification is not done: ${extensionId}`);
          return void 0;
        }
        const startTime = (/* @__PURE__ */ new Date()).getTime();
        let result;
        try {
          this.b.trace(`Verifying extension signature for ${extensionId}...`);
          result = await module2.verify(vsixFilePath, signatureArchiveFilePath, this.b.getLevel() === LogLevel.Trace);
        } catch (e) {
          result = {
            code: ExtensionSignatureVerificationCode.UnknownError,
            didExecute: false,
            output: $qb(e)
          };
        }
        const duration = (/* @__PURE__ */ new Date()).getTime() - startTime;
        this.b.info(`Extension signature verification result for ${extensionId}: ${result.code}. Executed: ${result.didExecute}. Duration: ${duration}ms.`);
        this.b.trace(`Extension signature verification output for ${extensionId}:
${result.output}`);
        this.c.publicLog2("extensionsignature:verification", {
          extensionId,
          extensionVersion: version,
          code: result.code,
          internalCode: result.internalCode,
          duration,
          didExecute: result.didExecute,
          clientTargetPlatform
        });
        return { code: result.code };
      }
    };
    $aX = __decorate([
      __param(0, $wn),
      __param(1, $zv)
    ], $aX);
  }
});

// out-build/vs/platform/extensionManagement/node/extensionDownloader.js
var $qX_1, $qX;
var init_extensionDownloader = __esm({
  "out-build/vs/platform/extensionManagement/node/extensionDownloader.js"() {
    "use strict";
    init_async();
    init_errors();
    init_lifecycle();
    init_network();
    init_resources();
    init_semver();
    init_uuid();
    init_pfs();
    init_zip();
    init_environment();
    init_abstractExtensionManagementService();
    init_extensionManagement();
    init_extensionManagementUtil();
    init_extensionManagementUtil2();
    init_extensionSignatureVerificationService();
    init_files();
    init_log();
    init_telemetry();
    init_uriIdentity();
    $qX = class $qX2 extends $3c {
      static {
        $qX_1 = this;
      }
      static {
        this.c = ".sigzip";
      }
      constructor(environmentService, j, m, n, r, t, u) {
        super();
        this.j = j;
        this.m = m;
        this.n = n;
        this.r = r;
        this.t = t;
        this.u = u;
        this.extensionsDownloadDir = environmentService.extensionsDownloadLocation;
        this.f = t.extUri.joinPath(environmentService.extensionsDownloadLocation, `.trash`);
        this.g = 20;
        this.h = this.F();
      }
      async download(extension, operation, verifySignature, clientTargetPlatform) {
        await this.h;
        const location2 = await this.w(extension, operation);
        if (!verifySignature) {
          return { location: location2, verificationStatus: void 0 };
        }
        if (!extension.isSigned) {
          return { location: location2, verificationStatus: ExtensionSignatureVerificationCode.NotSigned };
        }
        let signatureArchiveLocation;
        try {
          signatureArchiveLocation = await this.y(extension);
          const verificationStatus = (await this.n.verify(extension.identifier.id, extension.version, location2.fsPath, signatureArchiveLocation.fsPath, clientTargetPlatform))?.code;
          if (verificationStatus === ExtensionSignatureVerificationCode.PackageIsInvalidZip || verificationStatus === ExtensionSignatureVerificationCode.SignatureArchiveIsInvalidZip) {
            try {
              await this.delete(location2);
            } catch (error) {
              this.u.error(error);
            }
            throw new $rA(
              $jX,
              "CorruptZip"
              /* ExtensionManagementErrorCode.CorruptZip */
            );
          }
          return { location: location2, verificationStatus };
        } catch (error) {
          try {
            await this.delete(location2);
          } catch (error2) {
            this.u.error(error2);
          }
          throw error;
        } finally {
          if (signatureArchiveLocation) {
            try {
              await this.delete(signatureArchiveLocation);
            } catch (error) {
              this.u.error(error);
            }
          }
        }
      }
      async w(extension, operation) {
        try {
          const location2 = $vh(this.extensionsDownloadDir, this.G(extension));
          const attempts = await this.C(extension, "vsix", async () => {
            await this.z(extension, location2, (location3) => this.m.download(extension, location3, operation));
            try {
              await this.D(location2.fsPath, "extension/package.json");
            } catch (error) {
              try {
                await this.j.del(location2);
              } catch (e) {
                this.u.warn(`Error while deleting: ${location2.path}`, $qb(e));
              }
              throw error;
            }
          }, 2);
          if (attempts > 1) {
            this.r.publicLog2("extensiongallery:downloadvsix:retry", {
              extensionId: extension.identifier.id,
              attempts
            });
          }
          return location2;
        } catch (e) {
          throw $eX(
            e,
            "Download"
            /* ExtensionManagementErrorCode.Download */
          );
        }
      }
      async y(extension) {
        try {
          const location2 = $vh(this.extensionsDownloadDir, `${this.G(extension)}${$qX_1.c}`);
          const attempts = await this.C(extension, "sigzip", async () => {
            await this.m.downloadSignatureArchive(extension, location2);
            try {
              await this.D(location2.fsPath, ".signature.p7s");
            } catch (error) {
              try {
                await this.j.del(location2);
              } catch (e) {
                this.u.warn(`Error while deleting: ${location2.path}`, $qb(e));
              }
              throw error;
            }
          }, 2);
          if (attempts > 1) {
            this.r.publicLog2("extensiongallery:downloadsigzip:retry", {
              extensionId: extension.identifier.id,
              attempts
            });
          }
          return location2;
        } catch (e) {
          throw $eX(
            e,
            "DownloadSignature"
            /* ExtensionManagementErrorCode.DownloadSignature */
          );
        }
      }
      async z(extension, location2, downloadFn) {
        if (await this.j.exists(location2)) {
          return;
        }
        if (location2.scheme !== Schemas.file) {
          await downloadFn(location2);
          return;
        }
        const tempLocation = $vh(this.extensionsDownloadDir, `.${$ps()}`);
        try {
          await downloadFn(tempLocation);
        } catch (error) {
          try {
            await this.j.del(tempLocation);
          } catch (e) {
          }
          throw error;
        }
        try {
          await Promises2.rename(
            tempLocation.fsPath,
            location2.fsPath,
            2 * 60 * 1e3
            /* Retry for 2 minutes */
          );
        } catch (error) {
          try {
            await this.j.del(tempLocation);
          } catch (e) {
          }
          let exists2 = false;
          try {
            exists2 = await this.j.exists(location2);
          } catch (e) {
          }
          if (exists2) {
            this.u.info(`Rename failed because the file was downloaded by another source. So ignoring renaming.`, extension.identifier.id, location2.path);
          } else {
            this.u.info(`Rename failed because of ${$qb(error)}. Deleted the file from downloaded location`, tempLocation.path);
            throw error;
          }
        }
      }
      async C(extension, name, downloadFn, retries) {
        let attempts = 1;
        while (true) {
          try {
            await downloadFn();
            return attempts;
          } catch (e) {
            if (attempts++ > retries) {
              throw e;
            }
            this.u.warn(`Failed downloading ${name}. ${$qb(e)}. Retry again...`, extension.identifier.id);
          }
        }
      }
      async D(zipPath, filePath) {
        try {
          await $nX(zipPath, filePath);
        } catch (e) {
          throw $oX(e);
        }
      }
      async delete(location2) {
        await this.h;
        const trashRelativePath = this.t.extUri.relativePath(this.extensionsDownloadDir, location2);
        if (trashRelativePath) {
          await this.j.move(location2, this.t.extUri.joinPath(this.f, trashRelativePath), true);
        } else {
          await this.j.del(location2);
        }
      }
      async F() {
        try {
          if (!await this.j.exists(this.extensionsDownloadDir)) {
            this.u.trace("Extension VSIX downloads cache dir does not exist");
            return;
          }
          try {
            await this.j.del(this.f, { recursive: true });
          } catch (error) {
            if ($Bm(error) !== 1) {
              this.u.error(error);
            }
          }
          const folderStat = await this.j.resolve(this.extensionsDownloadDir, { resolveMetadata: true });
          if (folderStat.children) {
            const toDelete = [];
            const vsixs = [];
            const signatureArchives = [];
            for (const stat of folderStat.children) {
              if (stat.name.endsWith($qX_1.c)) {
                signatureArchives.push(stat.resource);
              } else {
                const extension = $EA.parse(stat.name);
                if (extension) {
                  vsixs.push([extension, stat]);
                }
              }
            }
            const byExtension = $JA(vsixs, ([extension]) => extension);
            const distinct = [];
            for (const p of byExtension) {
              p.sort((a, b) => rcompare(a[0].version, b[0].version));
              toDelete.push(...p.slice(1).map((e) => e[1].resource));
              distinct.push(p[0][1]);
            }
            distinct.sort((a, b) => a.mtime - b.mtime);
            toDelete.push(...distinct.slice(0, Math.max(0, distinct.length - this.g)).map((s) => s.resource));
            toDelete.push(...signatureArchives);
            await Promises.settled(toDelete.map((resource) => {
              this.u.trace("Deleting from cache", resource.path);
              return this.j.del(resource);
            }));
          }
        } catch (e) {
          this.u.error(e);
        }
      }
      G(extension) {
        return $EA.create(extension).toString().toLowerCase();
      }
    };
    $qX = $qX_1 = __decorate([
      __param(0, $Yk),
      __param(1, $km),
      __param(2, $pA),
      __param(3, $_W),
      __param(4, $zv),
      __param(5, $vl),
      __param(6, $wn)
    ], $qX);
  }
});

// out-build/vs/platform/extensionManagement/node/extensionLifecycle.js
import { fork } from "child_process";
var $rX;
var init_extensionLifecycle = __esm({
  "out-build/vs/platform/extensionManagement/node/extensionLifecycle.js"() {
    "use strict";
    init_async();
    init_errorMessage();
    init_event();
    init_lifecycle();
    init_network();
    init_path();
    init_pfs();
    init_log();
    init_userDataProfile();
    $rX = class $rX2 extends $3c {
      constructor(b, f) {
        super();
        this.b = b;
        this.f = f;
        this.a = new $2h(5);
      }
      async postUninstall(extension) {
        const script = this.g(extension, "uninstall");
        if (script) {
          this.f.info(extension.identifier.id, extension.manifest.version, `Running post uninstall script`);
          await this.a.queue(async () => {
            try {
              await this.h(script.script, "uninstall", script.args, true, extension);
              this.f.info(`Finished running post uninstall script`, extension.identifier.id, extension.manifest.version);
            } catch (error) {
              this.f.error("Failed to run post uninstall script", extension.identifier.id, extension.manifest.version);
              this.f.error(error);
            }
          });
        }
        try {
          await Promises2.rm(this.m(extension));
        } catch (error) {
          this.f.error("Error while removing extension storage path", extension.identifier.id);
          this.f.error(error);
        }
      }
      g(extension, type2) {
        const scriptKey = `vscode:${type2}`;
        if (extension.location.scheme === Schemas.file && extension.manifest && extension.manifest["scripts"] && typeof extension.manifest["scripts"][scriptKey] === "string") {
          const script = extension.manifest["scripts"][scriptKey].split(" ");
          if (script.length < 2 || script[0] !== "node" || !script[1]) {
            this.f.warn(extension.identifier.id, extension.manifest.version, `${scriptKey} should be a node script`);
            return null;
          }
          return { script: $nc(extension.location.fsPath, script[1]), args: script.slice(2) || [] };
        }
        return null;
      }
      h(lifecycleHook, lifecycleType, args, timeout, extension) {
        return new Promise((c, e) => {
          const extensionLifecycleProcess = this.j(lifecycleHook, lifecycleType, args, extension);
          let timeoutHandler;
          const onexit = (error) => {
            if (timeoutHandler) {
              clearTimeout(timeoutHandler);
              timeoutHandler = null;
            }
            if (error) {
              e(error);
            } else {
              c(void 0);
            }
          };
          extensionLifecycleProcess.on("error", (err) => {
            onexit($1m(err) || "Unknown");
          });
          extensionLifecycleProcess.on("exit", (code, signal) => {
            onexit(code ? `post-${lifecycleType} process exited with code ${code}` : void 0);
          });
          if (timeout) {
            timeoutHandler = setTimeout(() => {
              timeoutHandler = null;
              extensionLifecycleProcess.kill();
              e("timed out");
            }, 5e3);
          }
        });
      }
      j(uninstallHook, lifecycleType, args, extension) {
        const opts = {
          silent: true,
          execArgv: void 0
        };
        const extensionUninstallProcess = fork(uninstallHook, [`--type=extension-post-${lifecycleType}`, ...args], opts);
        extensionUninstallProcess.stdout.setEncoding("utf8");
        extensionUninstallProcess.stderr.setEncoding("utf8");
        const onStdout = Event.fromNodeEventEmitter(extensionUninstallProcess.stdout, "data");
        const onStderr = Event.fromNodeEventEmitter(extensionUninstallProcess.stderr, "data");
        this.B(onStdout((data) => this.f.info(extension.identifier.id, extension.manifest.version, `post-${lifecycleType}`, data)));
        this.B(onStderr((data) => this.f.error(extension.identifier.id, extension.manifest.version, `post-${lifecycleType}`, data)));
        const onOutput = Event.any(Event.map(onStdout, (o) => ({ data: `%c${o}`, format: [""] }), this.q), Event.map(onStderr, (o) => ({ data: `%c${o}`, format: ["color: red"] }), this.q));
        const onDebouncedOutput = Event.debounce(onOutput, (r, o) => {
          return r ? { data: r.data + o.data, format: [...r.format, ...o.format] } : { data: o.data, format: o.format };
        }, 100, void 0, void 0, void 0, this.q);
        onDebouncedOutput((data) => {
          console.group(extension.identifier.id);
          console.log(data.data, ...data.format);
          console.groupEnd();
        });
        return extensionUninstallProcess;
      }
      m(extension) {
        return $nc(this.b.defaultProfile.globalStorageHome.fsPath, extension.identifier.id.toLowerCase());
      }
    };
    $rX = __decorate([
      __param(0, $rs),
      __param(1, $wn)
    ], $rX);
  }
});

// out-build/vs/platform/extensionManagement/node/extensionsManifestCache.js
var $sX;
var init_extensionsManifestCache = __esm({
  "out-build/vs/platform/extensionManagement/node/extensionsManifestCache.js"() {
    "use strict";
    init_lifecycle();
    init_extensions();
    init_files();
    $sX = class extends $3c {
      constructor(a, b, c, extensionsManagementService, f) {
        super();
        this.a = a;
        this.b = b;
        this.c = c;
        this.f = f;
        this.B(extensionsManagementService.onDidInstallExtensions((e) => this.g(e)));
        this.B(extensionsManagementService.onDidUninstallExtension((e) => this.h(e)));
      }
      g(results) {
        for (const r of results) {
          if (r.local) {
            this.invalidate(r.profileLocation);
          }
        }
      }
      h(e) {
        if (!e.error) {
          this.invalidate(e.profileLocation);
        }
      }
      async invalidate(extensionsManifestLocation) {
        if (extensionsManifestLocation) {
          for (const profile of this.a.profiles) {
            if (this.c.extUri.isEqual(profile.extensionsResource, extensionsManifestLocation)) {
              await this.j(profile);
            }
          }
        } else {
          await this.j(this.a.defaultProfile);
        }
      }
      async j(profile) {
        try {
          await this.b.del(this.c.extUri.joinPath(profile.cacheHome, $Yz));
        } catch (error) {
          if ($Bm(error) !== 1) {
            this.f.error(error);
          }
        }
      }
    };
  }
});

// out-build/vs/platform/extensionManagement/node/extensionsWatcher.js
var $tX;
var init_extensionsWatcher = __esm({
  "out-build/vs/platform/extensionManagement/node/extensionsWatcher.js"() {
    "use strict";
    init_errors();
    init_event();
    init_lifecycle();
    init_map();
    init_extensionManagementUtil();
    init_extensions();
    $tX = class extends $3c {
      constructor(f, g, h, j, m, n, r) {
        super();
        this.f = f;
        this.g = g;
        this.h = h;
        this.j = j;
        this.m = m;
        this.n = n;
        this.r = r;
        this.a = this.B(new $ze());
        this.onDidChangeExtensionsByAnotherSource = this.a.event;
        this.b = /* @__PURE__ */ new Map();
        this.c = this.B(new $_c());
        this.s().then(null, (error) => r.error("Error while initializing Extensions Watcher", $qb(error)));
      }
      async s() {
        await this.g.initializeDefaultProfileExtensions();
        await this.u(this.h.profiles);
        this.t();
        await this.H();
      }
      t() {
        this.B(this.h.onDidChangeProfiles((e) => this.u(e.added)));
        this.B(this.j.onAddExtensions((e) => this.w(e)));
        this.B(this.j.onDidAddExtensions((e) => this.y(e)));
        this.B(this.j.onRemoveExtensions((e) => this.z(e)));
        this.B(this.j.onDidRemoveExtensions((e) => this.C(e)));
        this.B(this.n.onDidFilesChange((e) => this.D(e)));
      }
      async u(added) {
        try {
          if (added.length) {
            await Promise.all(added.map((profile) => {
              this.c.set(profile.id, $Zc(
                this.n.watch(this.m.extUri.dirname(profile.extensionsResource)),
                // Also listen to the resource incase the resource is a symlink - https://github.com/microsoft/vscode/issues/118134
                this.n.watch(profile.extensionsResource)
              ));
              return this.G(profile.extensionsResource);
            }));
          }
        } catch (error) {
          this.r.error(error);
          throw error;
        }
      }
      async w(e) {
        for (const extension of e.extensions) {
          this.I(this.L(extension.identifier, extension.version), e.profileLocation);
        }
      }
      async y(e) {
        for (const extension of e.extensions) {
          const key = this.L(extension.identifier, extension.version);
          if (e.error) {
            this.J(key, e.profileLocation);
          } else {
            this.I(key, e.profileLocation);
          }
        }
      }
      async z(e) {
        for (const extension of e.extensions) {
          this.J(this.L(extension.identifier, extension.version), e.profileLocation);
        }
      }
      async C(e) {
        const extensionsToUninstall = [];
        const promises15 = [];
        for (const extension of e.extensions) {
          const key = this.L(extension.identifier, extension.version);
          if (e.error) {
            this.I(key, e.profileLocation);
          } else {
            this.J(key, e.profileLocation);
            if (!this.b.has(key)) {
              this.r.debug("Extension is removed from all profiles", extension.identifier.id, extension.version);
              promises15.push(this.f.scanInstalledExtensionAtLocation(extension.location).then((result) => {
                if (result) {
                  extensionsToUninstall.push(result);
                } else {
                  this.r.info("Extension not found at the location", extension.location.toString());
                }
              }, (error) => this.r.error(error)));
            }
          }
        }
        try {
          await Promise.all(promises15);
          if (extensionsToUninstall.length) {
            await this.H(extensionsToUninstall);
          }
        } catch (error) {
          this.r.error(error);
        }
      }
      D(e) {
        for (const profile of this.h.profiles) {
          if (e.contains(
            profile.extensionsResource,
            0,
            1
            /* FileChangeType.ADDED */
          )) {
            this.F(profile.extensionsResource);
          }
        }
      }
      async F(profileLocation) {
        const added = [], removed = [];
        const extensions = await this.j.scanProfileExtensions(profileLocation);
        const extensionKeys = /* @__PURE__ */ new Set();
        const cached = /* @__PURE__ */ new Set();
        for (const [key, profiles] of this.b) {
          if (profiles.has(profileLocation)) {
            cached.add(key);
          }
        }
        for (const extension of extensions) {
          const key = this.L(extension.identifier, extension.version);
          extensionKeys.add(key);
          if (!cached.has(key)) {
            added.push(extension.identifier);
            this.I(key, profileLocation);
          }
        }
        for (const key of cached) {
          if (!extensionKeys.has(key)) {
            const extension = this.M(key);
            if (extension) {
              removed.push(extension.identifier);
              this.J(key, profileLocation);
            }
          }
        }
        if (added.length || removed.length) {
          this.a.fire({ added: added.length ? { extensions: added, profileLocation } : void 0, removed: removed.length ? { extensions: removed, profileLocation } : void 0 });
        }
      }
      async G(extensionsProfileLocation) {
        const extensions = await this.j.scanProfileExtensions(extensionsProfileLocation);
        for (const extension of extensions) {
          this.I(this.L(extension.identifier, extension.version), extensionsProfileLocation);
        }
      }
      async H(toUninstall) {
        if (!toUninstall) {
          const installed = await this.f.scanAllUserInstalledExtensions();
          toUninstall = installed.filter((installedExtension) => !this.b.has(this.L(installedExtension.identifier, installedExtension.manifest.version)));
        }
        if (toUninstall.length) {
          await this.f.markAsUninstalled(...toUninstall);
        }
      }
      I(key, extensionsProfileLocation) {
        let profiles = this.b.get(key);
        if (!profiles) {
          this.b.set(key, profiles = new $Fc((uri) => this.m.extUri.getComparisonKey(uri)));
        }
        profiles.add(extensionsProfileLocation);
      }
      J(key, profileLocation) {
        const profiles = this.b.get(key);
        if (profiles) {
          profiles.delete(profileLocation);
        }
        if (!profiles?.size) {
          this.b.delete(key);
        }
      }
      L(identifier, version) {
        return `${$5z.toKey(identifier.id)}@${version}`;
      }
      M(key) {
        const [id2, version] = $FA(key);
        return version ? { identifier: { id: id2 }, version } : void 0;
      }
    };
  }
});

// out-build/vs/platform/extensionManagement/node/extensionManagementService.js
import * as fs5 from "fs";
var $uX, DELETED_FOLDER_POSTFIX, $vX, $wX, InstallExtensionInProfileTask, UninstallExtensionInProfileTask;
var init_extensionManagementService = __esm({
  "out-build/vs/platform/extensionManagement/node/extensionManagementService.js"() {
    "use strict";
    init_async();
    init_buffer();
    init_cancellation();
    init_errorMessage();
    init_errors();
    init_event();
    init_hash();
    init_lifecycle();
    init_map();
    init_network();
    init_path();
    init_resources();
    init_semver();
    init_types();
    init_uri();
    init_uuid();
    init_pfs();
    init_zip();
    init_nls2();
    init_download();
    init_environment();
    init_abstractExtensionManagementService();
    init_extensionManagement();
    init_extensionManagementUtil();
    init_extensionsProfileScannerService();
    init_extensionsScannerService();
    init_extensionDownloader();
    init_extensionLifecycle();
    init_extensionManagementUtil2();
    init_extensionsManifestCache();
    init_extensionsWatcher();
    init_extensionValidator();
    init_files();
    init_instantiation();
    init_log();
    init_productService();
    init_telemetry();
    init_uriIdentity();
    init_userDataProfile();
    init_configuration();
    init_platform();
    $uX = $Rk($sA);
    DELETED_FOLDER_POSTFIX = ".vsctmp";
    $vX = class $vX2 extends $dX {
      constructor(galleryService, telemetryService, logService, gb, hb, ib, jb, kb, lb, mb, productService, allowedExtensionsService, uriIdentityService, userDataProfilesService) {
        super(galleryService, telemetryService, uriIdentityService, logService, productService, allowedExtensionsService, userDataProfilesService);
        this.gb = gb;
        this.hb = hb;
        this.ib = ib;
        this.jb = jb;
        this.kb = kb;
        this.lb = lb;
        this.mb = mb;
        this.fb = /* @__PURE__ */ new Map();
        this.yb = new $Fc();
        const extensionLifecycle = this.B(kb.createInstance($rX));
        this.cb = this.B(kb.createInstance($wX, (extension) => extensionLifecycle.postUninstall(extension)));
        this.db = this.B(new $sX(userDataProfilesService, lb, uriIdentityService, this, this.I));
        this.eb = this.B(kb.createInstance($qX));
        const extensionsWatcher = this.B(new $tX(this, this.hb, userDataProfilesService, ib, uriIdentityService, lb, logService));
        this.B(extensionsWatcher.onDidChangeExtensionsByAnotherSource((e) => this.xb(e)));
        this.zb();
      }
      getTargetPlatform() {
        if (!this.nb) {
          this.nb = $OA(this.lb, this.I);
        }
        return this.nb;
      }
      async zip(extension) {
        this.I.trace("ExtensionManagementService#zip", extension.identifier.id);
        const files = await this.wb(extension);
        const location2 = await zip($vh(this.eb.extensionsDownloadDir, $ps()).fsPath, files);
        return URI.file(location2);
      }
      async getManifest(vsix) {
        const { location: location2, cleanup } = await this.pb(vsix);
        const zipPath = $oc(location2.fsPath);
        try {
          return await $pX(zipPath);
        } finally {
          await cleanup();
        }
      }
      getInstalled(type2, profileLocation = this.J.defaultProfile.extensionsResource, productVersion = { version: this.g.version, date: this.g.date }) {
        return this.cb.scanExtensions(type2 ?? null, profileLocation, productVersion);
      }
      scanAllUserInstalledExtensions() {
        return this.cb.scanAllUserExtensions(false);
      }
      scanInstalledExtensionAtLocation(location2) {
        return this.cb.scanUserExtensionAtLocation(location2);
      }
      async install(vsix, options2 = {}) {
        this.I.trace("ExtensionManagementService#install", vsix.toString());
        const { location: location2, cleanup } = await this.pb(vsix);
        try {
          const manifest = await $pX($oc(location2.fsPath));
          const extensionId = $IA(manifest.publisher, manifest.name);
          if (manifest.engines && manifest.engines.vscode && !$1A(manifest.engines.vscode, this.g.version, this.g.date)) {
            throw new Error(localize(1862, null, extensionId, this.g.version));
          }
          const allowedToInstall = this.h.isAllowed({ id: extensionId, version: manifest.version, publisherDisplayName: void 0 });
          if (allowedToInstall !== true) {
            throw new Error(localize(1863, null, allowedToInstall.value));
          }
          const results = await this.L([{ manifest, extension: location2, options: options2 }]);
          const result = results.find(({ identifier }) => $DA(identifier, { id: extensionId }));
          if (result?.local) {
            return result.local;
          }
          if (result?.error) {
            throw result.error;
          }
          throw $eX(new Error(`Unknown error while installing extension ${extensionId}`));
        } finally {
          await cleanup();
        }
      }
      async installFromLocation(location2, profileLocation) {
        this.I.trace("ExtensionManagementService#installFromLocation", location2.toString());
        const local = await this.cb.scanUserExtensionAtLocation(location2);
        if (!local || !local.manifest.name || !local.manifest.version) {
          throw new Error(`Cannot find a valid extension from the location ${location2.toString()}`);
        }
        await this.Bb([[local, { source: "resource" }]], profileLocation);
        this.I.info("Successfully installed extension", local.identifier.id, profileLocation.toString());
        return local;
      }
      async installExtensionsFromProfile(extensions, fromProfileLocation, toProfileLocation) {
        this.I.trace("ExtensionManagementService#installExtensionsFromProfile", extensions, fromProfileLocation.toString(), toProfileLocation.toString());
        const extensionsToInstall = (await this.getInstalled(1, fromProfileLocation)).filter((e) => extensions.some((id2) => $DA(id2, e.identifier)));
        if (extensionsToInstall.length) {
          const metadata = await Promise.all(extensionsToInstall.map((e) => this.cb.scanMetadata(e, fromProfileLocation)));
          await this.Bb(extensionsToInstall.map((e, index) => [e, metadata[index]]), toProfileLocation);
          this.I.info("Successfully installed extensions", extensionsToInstall.map((e) => e.identifier.id), toProfileLocation.toString());
        }
        return extensionsToInstall;
      }
      async updateMetadata(local, metadata, profileLocation) {
        this.I.trace("ExtensionManagementService#updateMetadata", local.identifier.id);
        if (metadata.isPreReleaseVersion) {
          metadata.preRelease = true;
          metadata.hasPreReleaseVersion = true;
        }
        if (metadata.isMachineScoped === false) {
          metadata.isMachineScoped = void 0;
        }
        if (metadata.isBuiltin === false) {
          metadata.isBuiltin = void 0;
        }
        if (metadata.pinned === false) {
          metadata.pinned = void 0;
        }
        local = await this.cb.updateMetadata(local, metadata, profileLocation);
        this.db.invalidate(profileLocation);
        this.C.fire({ local, profileLocation });
        return local;
      }
      async reinstallFromGallery(extension) {
        this.I.trace("ExtensionManagementService#reinstallFromGallery", extension.identifier.id);
        if (!this.F.isEnabled()) {
          throw new Error(localize(1864, null));
        }
        const targetPlatform = await this.getTargetPlatform();
        const [galleryExtension] = await this.F.getExtensions([{ ...extension.identifier, preRelease: extension.preRelease }], { targetPlatform, compatible: true }, CancellationToken.None);
        if (!galleryExtension) {
          throw new Error(localize(1865, null));
        }
        await this.cb.setUninstalled(extension);
        try {
          await this.cb.removeUninstalledExtension(extension);
        } catch (e) {
          throw new Error(localize(1866, null, $1m(e)));
        }
        return this.installFromGallery(galleryExtension);
      }
      bb(extension, fromProfileLocation, toProfileLocation, metadata) {
        return this.cb.copyExtension(extension, fromProfileLocation, toProfileLocation, metadata);
      }
      copyExtensions(fromProfileLocation, toProfileLocation) {
        return this.cb.copyExtensions(fromProfileLocation, toProfileLocation, { version: this.g.version, date: this.g.date });
      }
      markAsUninstalled(...extensions) {
        return this.cb.setUninstalled(...extensions);
      }
      async cleanUp() {
        this.I.trace("ExtensionManagementService#cleanUp");
        try {
          await this.cb.cleanUp();
        } catch (error) {
          this.I.error(error);
        }
      }
      async download(extension, operation, donotVerifySignature) {
        const { location: location2 } = await this.ub(extension, operation, !donotVerifySignature);
        return location2;
      }
      async pb(vsix) {
        if (vsix.scheme === Schemas.file) {
          return { location: vsix, async cleanup() {
          } };
        }
        this.I.trace("Downloading extension from", vsix.toString());
        const location2 = $vh(this.eb.extensionsDownloadDir, $ps());
        await this.jb.download(vsix, location2);
        this.I.info("Downloaded extension to", location2.toString());
        const cleanup = async () => {
          try {
            await this.lb.del(location2);
          } catch (error) {
            this.I.error(error);
          }
        };
        return { location: location2, cleanup };
      }
      Z() {
        return this.J.defaultProfile.extensionsResource;
      }
      $(manifest, extension, options2) {
        const extensionKey = extension instanceof URI ? new $EA({ id: $IA(manifest.publisher, manifest.name) }, manifest.version) : $EA.create(extension);
        return this.kb.createInstance(InstallExtensionInProfileTask, extensionKey, manifest, extension, options2, (operation, token) => {
          if (extension instanceof URI) {
            return this.vb(extensionKey, extension, options2, token);
          }
          let promise = this.fb.get(extensionKey.toString());
          if (!promise) {
            this.fb.set(extensionKey.toString(), promise = this.tb(extensionKey, extension, operation, options2, token));
            promise.finally(() => this.fb.delete(extensionKey.toString()));
          }
          return promise;
        }, this.cb);
      }
      ab(extension, options2) {
        return new UninstallExtensionInProfileTask(extension, options2, this.ib);
      }
      async tb(extensionKey, gallery, operation, options2, token) {
        const { verificationStatus, location: location2 } = await this.ub(gallery, operation, !options2.donotVerifySignature, options2.context?.[$iA]);
        try {
          if (token.isCancellationRequested) {
            throw new $lb();
          }
          const manifest = await $pX(location2.fsPath);
          if (!new $EA(gallery.identifier, gallery.version).equals(new $EA({ id: $IA(manifest.publisher, manifest.name) }, manifest.version))) {
            throw new $rA(
              localize(1867, null, gallery.identifier.id),
              "Invalid"
              /* ExtensionManagementErrorCode.Invalid */
            );
          }
          const local = await this.cb.extractUserExtension(extensionKey, location2.fsPath, {
            id: gallery.identifier.uuid,
            publisherId: gallery.publisherId,
            publisherDisplayName: gallery.publisherDisplayName,
            targetPlatform: gallery.properties.targetPlatform,
            isApplicationScoped: options2.isApplicationScoped,
            isMachineScoped: options2.isMachineScoped,
            isBuiltin: options2.isBuiltin,
            isPreReleaseVersion: gallery.properties.isPreReleaseVersion,
            hasPreReleaseVersion: gallery.properties.isPreReleaseVersion,
            installedTimestamp: Date.now(),
            pinned: options2.installGivenVersion ? true : !!options2.pinned,
            preRelease: $Fg(options2.preRelease) ? options2.preRelease : options2.installPreReleaseVersion || gallery.properties.isPreReleaseVersion,
            source: "gallery"
          }, false, token);
          if (verificationStatus !== ExtensionSignatureVerificationCode.Success && this.gb.isBuilt) {
            try {
              await this.eb.delete(location2);
            } catch (e) {
              this.I.warn(`Error while deleting the downloaded file`, location2.toString(), $qb(e));
            }
          }
          return { local, verificationStatus };
        } catch (error) {
          try {
            await this.eb.delete(location2);
          } catch (e) {
            this.I.warn(`Error while deleting the downloaded file`, location2.toString(), $qb(e));
          }
          throw $eX(error);
        }
      }
      async ub(extension, operation, verifySignature, clientTargetPlatform) {
        if (verifySignature) {
          const value = this.mb.getValue("extensions.verifySignature");
          verifySignature = $Fg(value) ? value : true;
        }
        const { location: location2, verificationStatus } = await this.eb.download(extension, operation, verifySignature, clientTargetPlatform);
        if (verificationStatus !== ExtensionSignatureVerificationCode.Success && verificationStatus !== ExtensionSignatureVerificationCode.NotSigned && verifySignature && this.gb.isBuilt && !$n) {
          try {
            await this.eb.delete(location2);
          } catch (e) {
            this.I.warn(`Error while deleting the downloaded file`, location2.toString(), $qb(e));
          }
          if (!verificationStatus) {
            throw new $rA(
              localize(1868, null),
              "SignatureVerificationInternal"
              /* ExtensionManagementErrorCode.SignatureVerificationInternal */
            );
          }
          switch (verificationStatus) {
            case ExtensionSignatureVerificationCode.PackageIntegrityCheckFailed:
            case ExtensionSignatureVerificationCode.SignatureIsInvalid:
            case ExtensionSignatureVerificationCode.SignatureManifestIsInvalid:
            case ExtensionSignatureVerificationCode.SignatureIntegrityCheckFailed:
            case ExtensionSignatureVerificationCode.EntryIsMissing:
            case ExtensionSignatureVerificationCode.EntryIsTampered:
            case ExtensionSignatureVerificationCode.Untrusted:
            case ExtensionSignatureVerificationCode.CertificateRevoked:
            case ExtensionSignatureVerificationCode.SignatureIsNotValid:
            case ExtensionSignatureVerificationCode.SignatureArchiveHasTooManyEntries:
              throw new $rA(
                localize(1869, null, verificationStatus),
                "SignatureVerificationFailed"
                /* ExtensionManagementErrorCode.SignatureVerificationFailed */
              );
          }
          throw new $rA(
            localize(1870, null, verificationStatus),
            "SignatureVerificationInternal"
            /* ExtensionManagementErrorCode.SignatureVerificationInternal */
          );
        }
        return { location: location2, verificationStatus };
      }
      async vb(extensionKey, location2, options2, token) {
        const local = await this.cb.extractUserExtension(extensionKey, $oc(location2.fsPath), {
          isApplicationScoped: options2.isApplicationScoped,
          isMachineScoped: options2.isMachineScoped,
          isBuiltin: options2.isBuiltin,
          installedTimestamp: Date.now(),
          pinned: options2.installGivenVersion ? true : !!options2.pinned,
          source: "vsix"
        }, $Fg(options2.keepExisting) ? !options2.keepExisting : true, token);
        return { local };
      }
      async wb(extension) {
        const collectFilesFromDirectory = async (dir) => {
          let entries = await Promises2.readdir(dir);
          entries = entries.map((e) => $nc(dir, e));
          const stats = await Promise.all(entries.map((e) => fs5.promises.stat(e)));
          let promise = Promise.resolve([]);
          stats.forEach((stat, index) => {
            const entry = entries[index];
            if (stat.isFile()) {
              promise = promise.then((result) => [...result, entry]);
            }
            if (stat.isDirectory()) {
              promise = promise.then((result) => collectFilesFromDirectory(entry).then((files2) => [...result, ...files2]));
            }
          });
          return promise;
        };
        const files = await collectFilesFromDirectory(extension.location.fsPath);
        return files.map((f) => ({ path: `extension/${$pc(extension.location.fsPath, f)}`, localPath: f }));
      }
      async xb({ added, removed }) {
        if (removed) {
          const removedExtensions = added && this.H.extUri.isEqual(removed.profileLocation, added.profileLocation) ? removed.extensions.filter((e) => added.extensions.every((identifier) => !$DA(identifier, e))) : removed.extensions;
          for (const identifier of removedExtensions) {
            this.I.info("Extensions removed from another source", identifier.id, removed.profileLocation.toString());
            this.z.fire({ identifier, profileLocation: removed.profileLocation });
          }
        }
        if (added) {
          const extensions = await this.getInstalled(1, added.profileLocation);
          const addedExtensions = extensions.filter((e) => added.extensions.some((identifier) => $DA(identifier, e.identifier)));
          this.w.fire(addedExtensions.map((local) => {
            this.I.info("Extensions added from another source", local.identifier.id, added.profileLocation.toString());
            return {
              identifier: local.identifier,
              local,
              profileLocation: added.profileLocation,
              operation: 1
              /* InstallOperation.None */
            };
          }));
        }
      }
      async zb() {
        this.B(this.cb.onExtract((resource) => this.yb.add(resource)));
        const stat = await this.lb.resolve(this.hb.userExtensionsLocation);
        for (const childStat of stat.children ?? []) {
          if (childStat.isDirectory) {
            this.yb.add(childStat.resource);
          }
        }
        this.B(this.lb.watch(this.hb.userExtensionsLocation));
        this.B(this.lb.onDidFilesChange((e) => this.Ab(e)));
      }
      async Ab(e) {
        if (!e.affects(
          this.hb.userExtensionsLocation,
          1
          /* FileChangeType.ADDED */
        )) {
          return;
        }
        const added = [];
        for (const resource of e.rawAdded) {
          if (this.yb.has(resource)) {
            continue;
          }
          if (!this.H.extUri.isEqual(this.H.extUri.dirname(resource), this.hb.userExtensionsLocation)) {
            continue;
          }
          if (this.H.extUri.isEqual(resource, this.H.extUri.joinPath(this.hb.userExtensionsLocation, ".obsolete"))) {
            continue;
          }
          if (this.H.extUri.basename(resource).startsWith(".")) {
            continue;
          }
          if (!(await this.lb.stat(resource)).isDirectory) {
            continue;
          }
          const extension = await this.cb.scanUserExtensionAtLocation(resource);
          if (extension && extension.installedTimestamp === void 0) {
            this.yb.add(resource);
            added.push(extension);
          }
        }
        if (added.length) {
          await this.Bb(added.map((e2) => [e2, void 0]), this.J.defaultProfile.extensionsResource);
          this.I.info("Added extensions to default profile from external source", added.map((e2) => e2.identifier.id));
        }
      }
      async Bb(extensions, profileLocation) {
        const localExtensions = extensions.map((e) => e[0]);
        await this.Cb(localExtensions);
        await this.ib.addExtensionsToProfile(extensions, profileLocation);
        this.w.fire(localExtensions.map((local) => ({ local, identifier: local.identifier, operation: 1, profileLocation })));
      }
      async Cb(extensions) {
        const uninstalled = await this.cb.getUninstalledExtensions();
        for (const extension of extensions) {
          const extensionKey = $EA.create(extension);
          if (!uninstalled[extensionKey.toString()]) {
            continue;
          }
          this.I.trace("Removing the extension from uninstalled list:", extensionKey.id);
          await this.cb.setInstalled(extensionKey);
          this.I.info("Removed the extension from uninstalled list:", extensionKey.id);
        }
      }
    };
    $vX = __decorate([
      __param(0, $pA),
      __param(1, $zv),
      __param(2, $wn),
      __param(3, $Yk),
      __param(4, $4A),
      __param(5, $QA),
      __param(6, $6W),
      __param(7, $Pk),
      __param(8, $km),
      __param(9, $kl),
      __param(10, $Vu),
      __param(11, $xA),
      __param(12, $vl),
      __param(13, $rs)
    ], $vX);
    $wX = class $wX2 extends $3c {
      constructor(n, s, t, u, w, y, z) {
        super();
        this.n = n;
        this.s = s;
        this.t = t;
        this.u = u;
        this.w = w;
        this.y = y;
        this.z = z;
        this.h = this.B(new $ze());
        this.onExtract = this.h.event;
        this.j = new $Ec();
        this.m = new $Ec();
        this.c = $vh(this.t.userExtensionsLocation, ".obsolete");
        this.g = new $3h();
      }
      async cleanUp() {
        await this.L();
        await this.J();
        await this.I();
      }
      async scanExtensions(type2, profileLocation, productVersion) {
        try {
          const userScanOptions = { includeInvalid: true, profileLocation, productVersion };
          let scannedExtensions = [];
          if (type2 === null || type2 === 0) {
            let scanAllExtensionsPromise = this.j.get(profileLocation);
            if (!scanAllExtensionsPromise) {
              scanAllExtensionsPromise = this.t.scanAllExtensions({ includeInvalid: true, useCache: true }, userScanOptions, false).finally(() => this.j.delete(profileLocation));
              this.j.set(profileLocation, scanAllExtensionsPromise);
            }
            scannedExtensions.push(...await scanAllExtensionsPromise);
          } else if (type2 === 1) {
            let scanUserExtensionsPromise = this.m.get(profileLocation);
            if (!scanUserExtensionsPromise) {
              scanUserExtensionsPromise = this.t.scanUserExtensions(userScanOptions).finally(() => this.m.delete(profileLocation));
              this.m.set(profileLocation, scanUserExtensionsPromise);
            }
            scannedExtensions.push(...await scanUserExtensionsPromise);
          }
          scannedExtensions = type2 !== null ? scannedExtensions.filter((r) => r.type === type2) : scannedExtensions;
          return await Promise.all(scannedExtensions.map((extension) => this.H(extension)));
        } catch (error) {
          throw $eX(
            error,
            "Scanning"
            /* ExtensionManagementErrorCode.Scanning */
          );
        }
      }
      async scanAllUserExtensions(excludeOutdated) {
        try {
          const scannedExtensions = await this.t.scanUserExtensions({ includeAllVersions: !excludeOutdated, includeInvalid: true });
          return await Promise.all(scannedExtensions.map((extension) => this.H(extension)));
        } catch (error) {
          throw $eX(
            error,
            "Scanning"
            /* ExtensionManagementErrorCode.Scanning */
          );
        }
      }
      async scanUserExtensionAtLocation(location2) {
        try {
          const scannedExtension = await this.t.scanExistingExtension(location2, 1, { includeInvalid: true });
          if (scannedExtension) {
            return await this.H(scannedExtension);
          }
        } catch (error) {
          this.z.error(error);
        }
        return null;
      }
      async extractUserExtension(extensionKey, zipPath, metadata, removeIfExists, token) {
        const folderName = extensionKey.toString();
        const tempLocation = URI.file($nc(this.t.userExtensionsLocation.fsPath, `.${$ps()}`));
        const extensionLocation = URI.file($nc(this.t.userExtensionsLocation.fsPath, folderName));
        if (await this.s.exists(extensionLocation)) {
          if (!removeIfExists) {
            try {
              return await this.scanLocalExtension(
                extensionLocation,
                1
                /* ExtensionType.User */
              );
            } catch (error) {
              this.z.warn(`Error while scanning the existing extension at ${extensionLocation.path}. Deleting the existing extension and extracting it.`, $qb(error));
            }
          }
          try {
            await this.D(extensionKey.id, extensionLocation, "removeExisting");
          } catch (error) {
            throw new $rA(
              localize(1871, null, extensionLocation.fsPath, extensionKey.id),
              "Delete"
              /* ExtensionManagementErrorCode.Delete */
            );
          }
        }
        try {
          if (token.isCancellationRequested) {
            throw new $lb();
          }
          try {
            this.z.trace(`Started extracting the extension from ${zipPath} to ${extensionLocation.fsPath}`);
            await $mX(zipPath, tempLocation.fsPath, { sourcePath: "extension", overwrite: true }, token);
            this.z.info(`Extracted extension to ${extensionLocation}:`, extensionKey.id);
          } catch (e) {
            throw $oX(e);
          }
          try {
            metadata.size = await $yA(tempLocation, this.s);
          } catch (error) {
            this.z.warn(`Error while getting the size of the extracted extension : ${tempLocation.fsPath}`, $qb(error));
          }
          try {
            await this.t.updateMetadata(tempLocation, metadata);
          } catch (error) {
            this.y.publicLog2("extension:extract", { extensionId: extensionKey.id, code: `${$Bm(error)}` });
            throw $eX(
              error,
              "UpdateMetadata"
              /* ExtensionManagementErrorCode.UpdateMetadata */
            );
          }
          if (token.isCancellationRequested) {
            throw new $lb();
          }
          try {
            this.z.trace(`Started renaming the extension from ${tempLocation.fsPath} to ${extensionLocation.fsPath}`);
            await this.G(tempLocation.fsPath, extensionLocation.fsPath);
            this.z.info("Renamed to", extensionLocation.fsPath);
          } catch (error) {
            if (error.code === "ENOTEMPTY") {
              this.z.info(`Rename failed because extension was installed by another source. So ignoring renaming.`, extensionKey.id);
              try {
                await this.s.del(tempLocation, { recursive: true });
              } catch (e) {
              }
            } else {
              this.z.info(`Rename failed because of ${$qb(error)}. Deleted from extracted location`, tempLocation);
              throw error;
            }
          }
          this.h.fire(extensionLocation);
        } catch (error) {
          try {
            await this.s.del(tempLocation, { recursive: true });
          } catch (e) {
          }
          throw error;
        }
        return this.scanLocalExtension(
          extensionLocation,
          1
          /* ExtensionType.User */
        );
      }
      async scanMetadata(local, profileLocation) {
        if (profileLocation) {
          const extension = await this.C(local, profileLocation);
          return extension?.metadata;
        } else {
          return this.t.scanMetadata(local.location);
        }
      }
      async C(local, profileLocation) {
        const extensions = await this.u.scanProfileExtensions(profileLocation);
        return extensions.find((e) => $DA(e.identifier, local.identifier));
      }
      async updateMetadata(local, metadata, profileLocation) {
        try {
          if (profileLocation) {
            await this.u.updateMetadata([[local, metadata]], profileLocation);
          } else {
            await this.t.updateMetadata(local.location, metadata);
          }
        } catch (error) {
          this.y.publicLog2("extension:extract", { extensionId: local.identifier.id, code: `${$Bm(error)}`, isProfile: !!profileLocation });
          throw $eX(
            error,
            "UpdateMetadata"
            /* ExtensionManagementErrorCode.UpdateMetadata */
          );
        }
        return this.scanLocalExtension(local.location, local.type, profileLocation);
      }
      async getUninstalledExtensions() {
        try {
          return await this.F();
        } catch (error) {
          throw $eX(
            error,
            "ReadUninstalled"
            /* ExtensionManagementErrorCode.ReadUninstalled */
          );
        }
      }
      async setUninstalled(...extensions) {
        const extensionKeys = extensions.map((e) => $EA.create(e));
        await this.F((uninstalled) => extensionKeys.forEach((extensionKey) => {
          uninstalled[extensionKey.toString()] = true;
          this.z.info("Marked extension as uninstalled", extensionKey.toString());
        }));
      }
      async setInstalled(extensionKey) {
        try {
          await this.F((uninstalled) => delete uninstalled[extensionKey.toString()]);
        } catch (error) {
          throw $eX(
            error,
            "UnsetUninstalled"
            /* ExtensionManagementErrorCode.UnsetUninstalled */
          );
        }
      }
      async removeExtension(extension, type2) {
        if (this.w.extUri.isEqualOrParent(extension.location, this.t.userExtensionsLocation)) {
          return this.D(extension.identifier.id, extension.location, type2);
        }
      }
      async removeUninstalledExtension(extension) {
        await this.removeExtension(extension, "uninstalled");
        await this.F((uninstalled) => delete uninstalled[$EA.create(extension).toString()]);
      }
      async copyExtension(extension, fromProfileLocation, toProfileLocation, metadata) {
        const source = await this.C(extension, fromProfileLocation);
        const target = await this.C(extension, toProfileLocation);
        metadata = { ...source?.metadata, ...metadata };
        if (target) {
          if (this.w.extUri.isEqual(target.location, extension.location)) {
            await this.u.updateMetadata([[extension, { ...target.metadata, ...metadata }]], toProfileLocation);
          } else {
            const targetExtension = await this.scanLocalExtension(target.location, extension.type, toProfileLocation);
            await this.u.removeExtensionFromProfile(targetExtension, toProfileLocation);
            await this.u.addExtensionsToProfile([[extension, { ...target.metadata, ...metadata }]], toProfileLocation);
          }
        } else {
          await this.u.addExtensionsToProfile([[extension, metadata]], toProfileLocation);
        }
        return this.scanLocalExtension(extension.location, extension.type, toProfileLocation);
      }
      async copyExtensions(fromProfileLocation, toProfileLocation, productVersion) {
        const fromExtensions = await this.scanExtensions(1, fromProfileLocation, productVersion);
        const extensions = await Promise.all(fromExtensions.filter((e) => !e.isApplicationScoped).map(async (e) => [e, await this.scanMetadata(e, fromProfileLocation)]));
        await this.u.addExtensionsToProfile(extensions, toProfileLocation);
      }
      async D(id2, location2, type2) {
        this.z.trace(`Deleting ${type2} extension from disk`, id2, location2.fsPath);
        const renamedLocation = this.w.extUri.joinPath(this.w.extUri.dirname(location2), `${this.w.extUri.basename(location2)}.${$Xi($ps()).toString(16)}${DELETED_FOLDER_POSTFIX}`);
        await this.G(location2.fsPath, renamedLocation.fsPath);
        await this.s.del(renamedLocation, { recursive: true });
        this.z.info(`Deleted ${type2} extension from disk`, id2, location2.fsPath);
      }
      F(updateFn) {
        return this.g.queue(async () => {
          let raw;
          try {
            const content = await this.s.readFile(this.c, "utf8");
            raw = content.value.toString();
          } catch (error) {
            if ($Bm(error) !== 1) {
              throw error;
            }
          }
          let uninstalled = {};
          if (raw) {
            try {
              uninstalled = JSON.parse(raw);
            } catch (e) {
            }
          }
          if (updateFn) {
            updateFn(uninstalled);
            if (Object.keys(uninstalled).length) {
              await this.s.writeFile(this.c, $Ci.fromString(JSON.stringify(uninstalled)));
            } else {
              await this.s.del(this.c);
            }
          }
          return uninstalled;
        });
      }
      async G(extractPath, renamePath) {
        try {
          await Promises2.rename(
            extractPath,
            renamePath,
            2 * 60 * 1e3
            /* Retry for 2 minutes */
          );
        } catch (error) {
          throw $eX(
            error,
            "Rename"
            /* ExtensionManagementErrorCode.Rename */
          );
        }
      }
      async scanLocalExtension(location2, type2, profileLocation) {
        try {
          if (profileLocation) {
            const scannedExtensions = await this.t.scanUserExtensions({ profileLocation });
            const scannedExtension = scannedExtensions.find((e) => this.w.extUri.isEqual(e.location, location2));
            if (scannedExtension) {
              return await this.H(scannedExtension);
            }
          } else {
            const scannedExtension = await this.t.scanExistingExtension(location2, type2, { includeInvalid: true });
            if (scannedExtension) {
              return await this.H(scannedExtension);
            }
          }
          throw new $rA(
            localize(1872, null, location2.path),
            "ScanningExtension"
            /* ExtensionManagementErrorCode.ScanningExtension */
          );
        } catch (error) {
          throw $eX(
            error,
            "ScanningExtension"
            /* ExtensionManagementErrorCode.ScanningExtension */
          );
        }
      }
      async H(extension) {
        const stat = await this.s.resolve(extension.location);
        let readmeUrl;
        let changelogUrl;
        if (stat.children) {
          readmeUrl = stat.children.find(({ name }) => /^readme(\.txt|\.md|)$/i.test(name))?.resource;
          changelogUrl = stat.children.find(({ name }) => /^changelog(\.txt|\.md|)$/i.test(name))?.resource;
        }
        return {
          identifier: extension.identifier,
          type: extension.type,
          isBuiltin: extension.isBuiltin || !!extension.metadata?.isBuiltin,
          location: extension.location,
          manifest: extension.manifest,
          targetPlatform: extension.targetPlatform,
          validations: extension.validations,
          isValid: extension.isValid,
          readmeUrl,
          changelogUrl,
          publisherDisplayName: extension.metadata?.publisherDisplayName,
          publisherId: extension.metadata?.publisherId || null,
          isApplicationScoped: !!extension.metadata?.isApplicationScoped,
          isMachineScoped: !!extension.metadata?.isMachineScoped,
          isPreReleaseVersion: !!extension.metadata?.isPreReleaseVersion,
          hasPreReleaseVersion: !!extension.metadata?.hasPreReleaseVersion,
          preRelease: extension.preRelease,
          installedTimestamp: extension.metadata?.installedTimestamp,
          updated: !!extension.metadata?.updated,
          pinned: !!extension.metadata?.pinned,
          isWorkspaceScoped: false,
          source: extension.metadata?.source ?? (extension.identifier.uuid ? "gallery" : "vsix"),
          size: extension.metadata?.size ?? 0
        };
      }
      async I() {
        const extensions = await this.t.scanUserExtensions({ includeInvalid: true });
        await Promise.all(extensions.map(async (extension) => {
          if (!extension.metadata?.size && extension.metadata?.source !== "resource") {
            const size = await $yA(extension.location, this.s);
            await this.t.updateMetadata(extension.location, { size });
          }
        }));
      }
      async J() {
        const uninstalled = await this.getUninstalledExtensions();
        if (Object.keys(uninstalled).length === 0) {
          this.z.debug(`No uninstalled extensions found.`);
          return;
        }
        this.z.debug(`Removing uninstalled extensions:`, Object.keys(uninstalled));
        const extensions = await this.t.scanUserExtensions({ includeAllVersions: true, includeUninstalled: true, includeInvalid: true });
        const installed = /* @__PURE__ */ new Set();
        for (const e of extensions) {
          if (!uninstalled[$EA.create(e).toString()]) {
            installed.add(e.identifier.id.toLowerCase());
          }
        }
        try {
          const byExtension = $JA(extensions, (e) => e.identifier);
          await Promises.settled(byExtension.map(async (e) => {
            const latest = e.sort((a, b) => rcompare(a.manifest.version, b.manifest.version))[0];
            if (!installed.has(latest.identifier.id.toLowerCase())) {
              await this.n(await this.H(latest));
            }
          }));
        } catch (error) {
          this.z.error(error);
        }
        const toRemove = extensions.filter((e) => e.metadata && uninstalled[$EA.create(e).toString()]);
        await Promise.allSettled(toRemove.map((e) => this.removeUninstalledExtension(e)));
      }
      async L() {
        this.z.trace("ExtensionManagementService#removeTempDeleteFolders");
        let stat;
        try {
          stat = await this.s.resolve(this.t.userExtensionsLocation);
        } catch (error) {
          if ($Bm(error) !== 1) {
            this.z.error(error);
          }
          return;
        }
        if (!stat?.children) {
          return;
        }
        try {
          await Promise.allSettled(stat.children.map(async (child) => {
            if (!child.isDirectory || !child.name.endsWith(DELETED_FOLDER_POSTFIX)) {
              return;
            }
            this.z.trace("Deleting the temporarily deleted folder", child.resource.toString());
            try {
              await this.s.del(child.resource, { recursive: true });
              this.z.trace("Deleted the temporarily deleted folder", child.resource.toString());
            } catch (error) {
              if ($Bm(error) !== 1) {
                this.z.error(error);
              }
            }
          }));
        } catch (error) {
        }
      }
    };
    $wX = __decorate([
      __param(1, $km),
      __param(2, $4A),
      __param(3, $QA),
      __param(4, $vl),
      __param(5, $zv),
      __param(6, $wn)
    ], $wX);
    InstallExtensionInProfileTask = class InstallExtensionInProfileTask2 extends $fX {
      get operation() {
        return this.options.operation ?? this.j;
      }
      get verificationStatus() {
        return this.k;
      }
      constructor(l, manifest, source, options2, m, n, o, p, q, s, t, u) {
        super();
        this.l = l;
        this.manifest = manifest;
        this.source = source;
        this.options = options2;
        this.m = m;
        this.n = n;
        this.o = o;
        this.p = p;
        this.q = q;
        this.s = s;
        this.t = t;
        this.u = u;
        this.j = 2;
        this.identifier = this.l.identifier;
      }
      async h(token) {
        const installed = await this.n.scanExtensions(1, this.options.profileLocation, this.options.productVersion);
        const existingExtension = installed.find((i) => $DA(i.identifier, this.identifier));
        if (existingExtension) {
          this.j = 3;
        }
        const metadata = {
          isApplicationScoped: this.options.isApplicationScoped || existingExtension?.isApplicationScoped,
          isMachineScoped: this.options.isMachineScoped || existingExtension?.isMachineScoped,
          isBuiltin: this.options.isBuiltin || existingExtension?.isBuiltin,
          isSystem: existingExtension?.type === 0 ? true : void 0,
          installedTimestamp: Date.now(),
          pinned: this.options.installGivenVersion ? true : this.options.pinned ?? existingExtension?.pinned,
          source: this.source instanceof URI ? "vsix" : "gallery"
        };
        let local;
        if (this.source instanceof URI) {
          if (existingExtension) {
            if (this.l.equals(new $EA(existingExtension.identifier, existingExtension.manifest.version))) {
              try {
                await this.n.removeExtension(existingExtension, "existing");
              } catch (e) {
                throw new Error(localize(1873, null, this.manifest.displayName || this.manifest.name));
              }
            }
          }
          const existingWithSameVersion = await this.w(this.l);
          if (existingWithSameVersion) {
            try {
              await this.n.removeExtension(existingWithSameVersion, "existing");
            } catch (e) {
              throw new Error(localize(1874, null, this.manifest.displayName || this.manifest.name));
            }
          }
        } else {
          metadata.id = this.source.identifier.uuid;
          metadata.publisherId = this.source.publisherId;
          metadata.publisherDisplayName = this.source.publisherDisplayName;
          metadata.targetPlatform = this.source.properties.targetPlatform;
          metadata.updated = !!existingExtension;
          metadata.isPreReleaseVersion = this.source.properties.isPreReleaseVersion;
          metadata.hasPreReleaseVersion = existingExtension?.hasPreReleaseVersion || this.source.properties.isPreReleaseVersion;
          metadata.preRelease = $Fg(this.options.preRelease) ? this.options.preRelease : this.options.installPreReleaseVersion || this.source.properties.isPreReleaseVersion || existingExtension?.preRelease;
          if (existingExtension && existingExtension.type !== 0 && existingExtension.manifest.version === this.source.version) {
            return this.n.updateMetadata(existingExtension, metadata, this.options.profileLocation);
          }
          local = await this.w(this.l);
        }
        if (token.isCancellationRequested) {
          throw $eX(new $lb());
        }
        if (!local) {
          const result2 = await this.m(this.operation, token);
          local = result2.local;
          this.k = result2.verificationStatus;
        }
        if (this.o.extUri.isEqual(this.q.defaultProfile.extensionsResource, this.options.profileLocation)) {
          try {
            await this.s.initializeDefaultProfileExtensions();
          } catch (error) {
            throw $eX(
              error,
              "IntializeDefaultProfile"
              /* ExtensionManagementErrorCode.IntializeDefaultProfile */
            );
          }
        }
        if (token.isCancellationRequested) {
          throw $eX(new $lb());
        }
        try {
          await this.t.addExtensionsToProfile([[local, metadata]], this.options.profileLocation, !local.isValid);
        } catch (error) {
          throw $eX(
            error,
            "AddToProfile"
            /* ExtensionManagementErrorCode.AddToProfile */
          );
        }
        const result = await this.n.scanLocalExtension(local.location, 1, this.options.profileLocation);
        if (!result) {
          throw new $rA(
            "Cannot find the installed extension",
            "InstalledExtensionNotFound"
            /* ExtensionManagementErrorCode.InstalledExtensionNotFound */
          );
        }
        if (this.source instanceof URI) {
          this.x(local, token);
        }
        return result;
      }
      async w(extensionKey) {
        const uninstalled = await this.n.getUninstalledExtensions();
        if (!uninstalled[extensionKey.toString()]) {
          return void 0;
        }
        this.u.trace("Removing the extension from uninstalled list:", extensionKey.id);
        await this.n.setInstalled(extensionKey);
        this.u.info("Removed the extension from uninstalled list:", extensionKey.id);
        const userExtensions = await this.n.scanAllUserExtensions(true);
        return userExtensions.find((i) => $EA.create(i).equals(extensionKey));
      }
      async x(extension, token) {
        try {
          let [galleryExtension] = await this.p.getExtensions([{ id: extension.identifier.id, version: extension.manifest.version }], token);
          if (!galleryExtension) {
            [galleryExtension] = await this.p.getExtensions([{ id: extension.identifier.id }], token);
          }
          if (galleryExtension) {
            const metadata = {
              id: galleryExtension.identifier.uuid,
              publisherDisplayName: galleryExtension.publisherDisplayName,
              publisherId: galleryExtension.publisherId,
              isPreReleaseVersion: galleryExtension.properties.isPreReleaseVersion,
              hasPreReleaseVersion: extension.hasPreReleaseVersion || galleryExtension.properties.isPreReleaseVersion,
              preRelease: galleryExtension.properties.isPreReleaseVersion || this.options.installPreReleaseVersion
            };
            await this.n.updateMetadata(extension, metadata, this.options.profileLocation);
          }
        } catch (error) {
        }
      }
    };
    InstallExtensionInProfileTask = __decorate([
      __param(6, $vl),
      __param(7, $pA),
      __param(8, $rs),
      __param(9, $4A),
      __param(10, $QA),
      __param(11, $wn)
    ], InstallExtensionInProfileTask);
    UninstallExtensionInProfileTask = class extends $fX {
      constructor(extension, options2, j) {
        super();
        this.extension = extension;
        this.options = options2;
        this.j = j;
      }
      async h(token) {
        await this.j.removeExtensionFromProfile(this.extension, this.options.profileLocation);
      }
    };
  }
});

// out-build/vs/platform/instantiation/common/graph.js
var $8B, $9B;
var init_graph = __esm({
  "out-build/vs/platform/instantiation/common/graph.js"() {
    "use strict";
    $8B = class {
      constructor(key, data) {
        this.key = key;
        this.data = data;
        this.incoming = /* @__PURE__ */ new Map();
        this.outgoing = /* @__PURE__ */ new Map();
      }
    };
    $9B = class {
      constructor(b) {
        this.b = b;
        this.a = /* @__PURE__ */ new Map();
      }
      roots() {
        const ret = [];
        for (const node of this.a.values()) {
          if (node.outgoing.size === 0) {
            ret.push(node);
          }
        }
        return ret;
      }
      insertEdge(from, to) {
        const fromNode = this.lookupOrInsertNode(from);
        const toNode = this.lookupOrInsertNode(to);
        fromNode.outgoing.set(toNode.key, toNode);
        toNode.incoming.set(fromNode.key, fromNode);
      }
      removeNode(data) {
        const key = this.b(data);
        this.a.delete(key);
        for (const node of this.a.values()) {
          node.outgoing.delete(key);
          node.incoming.delete(key);
        }
      }
      lookupOrInsertNode(data) {
        const key = this.b(data);
        let node = this.a.get(key);
        if (!node) {
          node = new $8B(key, data);
          this.a.set(key, node);
        }
        return node;
      }
      lookup(data) {
        return this.a.get(this.b(data));
      }
      isEmpty() {
        return this.a.size === 0;
      }
      toString() {
        const data = [];
        for (const [key, value] of this.a) {
          data.push(`${key}
	(-> incoming)[${[...value.incoming.keys()].join(", ")}]
	(outgoing ->)[${[...value.outgoing.keys()].join(",")}]
`);
        }
        return data.join("\n");
      }
      /**
       * This is brute force and slow and **only** be used
       * to trouble shoot.
       */
      findCycleSlow() {
        for (const [id2, node] of this.a) {
          const seen = /* @__PURE__ */ new Set([id2]);
          const res = this.c(node, seen);
          if (res) {
            return res;
          }
        }
        return void 0;
      }
      c(node, seen) {
        for (const [id2, outgoing] of node.outgoing) {
          if (seen.has(id2)) {
            return [...seen, id2].join(" -> ");
          }
          seen.add(id2);
          const value = this.c(outgoing, seen);
          if (value) {
            return value;
          }
          seen.delete(id2);
        }
        return void 0;
      }
    };
  }
});

// out-build/vs/platform/instantiation/common/instantiationService.js
var _enableAllTracing, CyclicDependencyError, $0B, TraceType, $$B;
var init_instantiationService = __esm({
  "out-build/vs/platform/instantiation/common/instantiationService.js"() {
    "use strict";
    init_async();
    init_errors();
    init_lifecycle();
    init_descriptors();
    init_graph();
    init_instantiation();
    init_serviceCollection();
    init_linkedList();
    _enableAllTracing = false;
    CyclicDependencyError = class extends Error {
      constructor(graph) {
        super("cyclic dependency between services");
        this.message = graph.findCycleSlow() ?? `UNABLE to detect cycle, dumping graph: 
${graph.toString()}`;
      }
    };
    $0B = class _$0B {
      constructor(i = new $Ok(), j = false, k, l = _enableAllTracing) {
        this.i = i;
        this.j = j;
        this.k = k;
        this.l = l;
        this.f = false;
        this.g = /* @__PURE__ */ new Set();
        this.h = /* @__PURE__ */ new Set();
        this.t = /* @__PURE__ */ new Set();
        this.i.set($Pk, this);
        this._globalGraph = l ? k?._globalGraph ?? new $9B((e) => e) : void 0;
      }
      dispose() {
        if (!this.f) {
          this.f = true;
          $Xc(this.h);
          this.h.clear();
          for (const candidate of this.g) {
            if ($Wc(candidate)) {
              candidate.dispose();
            }
          }
          this.g.clear();
        }
      }
      m() {
        if (this.f) {
          throw new Error("InstantiationService has been disposed");
        }
      }
      createChild(services, store) {
        this.m();
        const that = this;
        const result = new class extends _$0B {
          dispose() {
            that.h.delete(result);
            super.dispose();
          }
        }(services, this.j, this, this.l);
        this.h.add(result);
        store?.add(result);
        return result;
      }
      invokeFunction(fn, ...args) {
        this.m();
        const _trace = $$B.traceInvocation(this.l, fn);
        let _done = false;
        try {
          const accessor = {
            get: (id2) => {
              if (_done) {
                throw $ob("service accessor is only valid during the invocation of its target method");
              }
              const result = this.s(id2, _trace);
              if (!result) {
                throw new Error(`[invokeFunction] unknown service '${id2}'`);
              }
              return result;
            }
          };
          return fn(accessor, ...args);
        } finally {
          _done = true;
          _trace.stop();
        }
      }
      createInstance(ctorOrDescriptor, ...rest) {
        this.m();
        let _trace;
        let result;
        if (ctorOrDescriptor instanceof $Nk) {
          _trace = $$B.traceCreation(this.l, ctorOrDescriptor.ctor);
          result = this.o(ctorOrDescriptor.ctor, ctorOrDescriptor.staticArguments.concat(rest), _trace);
        } else {
          _trace = $$B.traceCreation(this.l, ctorOrDescriptor);
          result = this.o(ctorOrDescriptor, rest, _trace);
        }
        _trace.stop();
        return result;
      }
      o(ctor, args = [], _trace) {
        const serviceDependencies = _util.getServiceDependencies(ctor).sort((a, b) => a.index - b.index);
        const serviceArgs = [];
        for (const dependency of serviceDependencies) {
          const service = this.s(dependency.id, _trace);
          if (!service) {
            this.y(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id}.`, false);
          }
          serviceArgs.push(service);
        }
        const firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length;
        if (args.length !== firstServiceArgPos) {
          console.trace(`[createInstance] First service dependency of ${ctor.name} at position ${firstServiceArgPos + 1} conflicts with ${args.length} static arguments`);
          const delta = firstServiceArgPos - args.length;
          if (delta > 0) {
            args = args.concat(new Array(delta));
          } else {
            args = args.slice(0, firstServiceArgPos);
          }
        }
        return Reflect.construct(ctor, args.concat(serviceArgs));
      }
      q(id2, instance) {
        if (this.i.get(id2) instanceof $Nk) {
          this.i.set(id2, instance);
        } else if (this.k) {
          this.k.q(id2, instance);
        } else {
          throw new Error("illegalState - setting UNKNOWN service instance");
        }
      }
      r(id2) {
        const instanceOrDesc = this.i.get(id2);
        if (!instanceOrDesc && this.k) {
          return this.k.r(id2);
        } else {
          return instanceOrDesc;
        }
      }
      s(id2, _trace) {
        if (this._globalGraph && this.c) {
          this._globalGraph.insertEdge(this.c, String(id2));
        }
        const thing = this.r(id2);
        if (thing instanceof $Nk) {
          return this.u(id2, thing, _trace.branch(id2, true));
        } else {
          _trace.branch(id2, false);
          return thing;
        }
      }
      u(id2, desc, _trace) {
        if (this.t.has(id2)) {
          throw new Error(`illegal state - RECURSIVELY instantiating service '${id2}'`);
        }
        this.t.add(id2);
        try {
          return this.v(id2, desc, _trace);
        } finally {
          this.t.delete(id2);
        }
      }
      v(id2, desc, _trace) {
        const graph = new $9B((data) => data.id.toString());
        let cycleCount = 0;
        const stack = [{ id: id2, desc, _trace }];
        const seen = /* @__PURE__ */ new Set();
        while (stack.length) {
          const item = stack.pop();
          if (seen.has(String(item.id))) {
            continue;
          }
          seen.add(String(item.id));
          graph.lookupOrInsertNode(item);
          if (cycleCount++ > 1e3) {
            throw new CyclicDependencyError(graph);
          }
          for (const dependency of _util.getServiceDependencies(item.desc.ctor)) {
            const instanceOrDesc = this.r(dependency.id);
            if (!instanceOrDesc) {
              this.y(`[createInstance] ${id2} depends on ${dependency.id} which is NOT registered.`, true);
            }
            this._globalGraph?.insertEdge(String(item.id), String(dependency.id));
            if (instanceOrDesc instanceof $Nk) {
              const d = { id: dependency.id, desc: instanceOrDesc, _trace: item._trace.branch(dependency.id, true) };
              graph.insertEdge(item, d);
              stack.push(d);
            }
          }
        }
        while (true) {
          const roots = graph.roots();
          if (roots.length === 0) {
            if (!graph.isEmpty()) {
              throw new CyclicDependencyError(graph);
            }
            break;
          }
          for (const { data } of roots) {
            const instanceOrDesc = this.r(data.id);
            if (instanceOrDesc instanceof $Nk) {
              const instance = this.w(data.id, data.desc.ctor, data.desc.staticArguments, data.desc.supportsDelayedInstantiation, data._trace);
              this.q(data.id, instance);
            }
            graph.removeNode(data);
          }
        }
        return this.r(id2);
      }
      w(id2, ctor, args = [], supportsDelayedInstantiation, _trace) {
        if (this.i.get(id2) instanceof $Nk) {
          return this.x(id2, ctor, args, supportsDelayedInstantiation, _trace, this.g);
        } else if (this.k) {
          return this.k.w(id2, ctor, args, supportsDelayedInstantiation, _trace);
        } else {
          throw new Error(`illegalState - creating UNKNOWN service instance ${ctor.name}`);
        }
      }
      x(id2, ctor, args = [], supportsDelayedInstantiation, _trace, disposeBucket) {
        if (!supportsDelayedInstantiation) {
          const result = this.o(ctor, args, _trace);
          disposeBucket.add(result);
          return result;
        } else {
          const child = new _$0B(void 0, this.j, this, this.l);
          child.c = String(id2);
          const earlyListeners = /* @__PURE__ */ new Map();
          const idle = new $ci(() => {
            const result = child.o(ctor, args, _trace);
            for (const [key, values] of earlyListeners) {
              const candidate = result[key];
              if (typeof candidate === "function") {
                for (const value of values) {
                  value.disposable = candidate.apply(result, value.listener);
                }
              }
            }
            earlyListeners.clear();
            disposeBucket.add(result);
            return result;
          });
          return new Proxy(/* @__PURE__ */ Object.create(null), {
            get(target, key) {
              if (!idle.isInitialized) {
                if (typeof key === "string" && (key.startsWith("onDid") || key.startsWith("onWill"))) {
                  let list2 = earlyListeners.get(key);
                  if (!list2) {
                    list2 = new $cd();
                    earlyListeners.set(key, list2);
                  }
                  const event = (callback, thisArg, disposables) => {
                    if (idle.isInitialized) {
                      return idle.value[key](callback, thisArg, disposables);
                    } else {
                      const entry = { listener: [callback, thisArg, disposables], disposable: void 0 };
                      const rm = list2.push(entry);
                      const result = $1c(() => {
                        rm();
                        entry.disposable?.dispose();
                      });
                      return result;
                    }
                  };
                  return event;
                }
              }
              if (key in target) {
                return target[key];
              }
              const obj = idle.value;
              let prop = obj[key];
              if (typeof prop !== "function") {
                return prop;
              }
              prop = prop.bind(obj);
              target[key] = prop;
              return prop;
            },
            set(_target, p, value) {
              idle.value[p] = value;
              return true;
            },
            getPrototypeOf(_target) {
              return ctor.prototype;
            }
          });
        }
      }
      y(msg, printWarning) {
        if (printWarning) {
          console.warn(msg);
        }
        if (this.j) {
          throw new Error(msg);
        }
      }
    };
    (function(TraceType2) {
      TraceType2[TraceType2["None"] = 0] = "None";
      TraceType2[TraceType2["Creation"] = 1] = "Creation";
      TraceType2[TraceType2["Invocation"] = 2] = "Invocation";
      TraceType2[TraceType2["Branch"] = 3] = "Branch";
    })(TraceType || (TraceType = {}));
    $$B = class _$$B {
      static {
        this.all = /* @__PURE__ */ new Set();
      }
      static {
        this.c = new class extends _$$B {
          constructor() {
            super(0, null);
          }
          stop() {
          }
          branch() {
            return this;
          }
        }();
      }
      static traceInvocation(_enableTracing, ctor) {
        return !_enableTracing ? _$$B.c : new _$$B(2, ctor.name || new Error().stack.split("\n").slice(3, 4).join("\n"));
      }
      static traceCreation(_enableTracing, ctor) {
        return !_enableTracing ? _$$B.c : new _$$B(1, ctor.name);
      }
      static {
        this.f = 0;
      }
      constructor(type2, name) {
        this.type = type2;
        this.name = name;
        this.g = Date.now();
        this.h = [];
      }
      branch(id2, first) {
        const child = new _$$B(3, id2.toString());
        this.h.push([id2, first, child]);
        return child;
      }
      stop() {
        const dur = Date.now() - this.g;
        _$$B.f += dur;
        let causedCreation = false;
        function printChild(n, trace) {
          const res = [];
          const prefix = new Array(n + 1).join("	");
          for (const [id2, first, child] of trace.h) {
            if (first && child) {
              causedCreation = true;
              res.push(`${prefix}CREATES -> ${id2}`);
              const nested = printChild(n + 1, child);
              if (nested) {
                res.push(nested);
              }
            } else {
              res.push(`${prefix}uses -> ${id2}`);
            }
          }
          return res.join("\n");
        }
        const lines = [
          `${this.type === 1 ? "CREATE" : "CALL"} ${this.name}`,
          `${printChild(1, this)}`,
          `DONE, took ${dur.toFixed(2)}ms (grand total ${_$$B.f.toFixed(2)}ms)`
        ];
        if (dur > 2 || causedCreation) {
          _$$B.all.add(lines.join("\n"));
        }
      }
    };
  }
});

// out-build/vs/platform/product/common/product.js
var product, vscodeGlobal2, product_default;
var init_product = __esm({
  "out-build/vs/platform/product/common/product.js"() {
    "use strict";
    init_process();
    vscodeGlobal2 = globalThis.vscode;
    if (typeof vscodeGlobal2 !== "undefined" && typeof vscodeGlobal2.context !== "undefined") {
      const configuration = vscodeGlobal2.context.configuration();
      if (configuration) {
        product = configuration.product;
      } else {
        throw new Error("Sandbox: unable to resolve product configuration from preload script.");
      }
    } else if (globalThis._VSCODE_PRODUCT_JSON && globalThis._VSCODE_PACKAGE_JSON) {
      product = globalThis._VSCODE_PRODUCT_JSON;
      if (env["VSCODE_DEV"]) {
        Object.assign(product, {
          nameShort: `${product.nameShort} Dev`,
          nameLong: `${product.nameLong} Dev`,
          dataFolderName: `${product.dataFolderName}-dev`,
          serverDataFolderName: product.serverDataFolderName ? `${product.serverDataFolderName}-dev` : void 0
        });
      }
      if (!product.version) {
        const pkg = globalThis._VSCODE_PACKAGE_JSON;
        Object.assign(product, {
          version: pkg.version
        });
      }
      if (env["EXTENSIONS_GALLERY"]) {
        Object.assign(product, {
          extensionsGallery: JSON.parse(env["EXTENSIONS_GALLERY"])
        });
      }
    } else {
      product = { "nameShort": "Code - OSS with Posit Workbench", "nameLong": "Code - OSS with Posit Workbench", "applicationName": "code-server", "dataFolderName": ".vscode-server", "win32MutexName": "vscodeoss", "licenseName": "MIT", "serverLicenseUrl": "https://posit.co/about/eula/", "licenseUrl": "https://posit.co/about/eula/", "serverGreeting": [], "serverLicense": [], "serverLicensePrompt": "", "serverApplicationName": "vscode-server", "serverDataFolderName": ".vscode-server", "tunnelApplicationName": "vscode-tunnel", "win32DirName": "Microsoft Code OSS", "win32NameVersion": "Microsoft Code OSS", "win32RegValueName": "CodeOSS", "win32AppId": "{{F9502347-C9F5-4EBE-8794-75836AAAD88D}", "win32x64AppId": "{{8DA74215-C267-4C6C-A88D-CD657F897B03}", "win32arm64AppId": "{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}", "win32UserAppId": "{{BA70F482-04D8-4BD6-B6C5-976E94C73E13}", "win32x64UserAppId": "{{D4272F45-0AAB-432E-89DE-DBC7DFA87F7D}", "win32arm64UserAppId": "{{B9BE1090-E373-4510-829E-D98C416CB4D9}", "win32AppUserModelId": "Microsoft.CodeOSS", "win32ShellNameShort": "C&ode - OSS", "win32TunnelServiceMutex": "vscodeoss-tunnelservice", "win32TunnelMutex": "vscodeoss-tunnel", "darwinBundleIdentifier": "com.visualstudio.code.oss", "linuxIconName": "code-oss", "licenseFileName": "LICENSE.txt", "reportIssueUrl": "https://github.com/microsoft/vscode/issues/new", "nodejsRepository": "https://nodejs.org", "urlProtocol": "vscode-server", "webviewContentExternalBaseUrlTemplate": "https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/", "builtInExtensions": [{ "name": "ms-vscode.js-debug-companion", "version": "1.1.3", "sha256": "7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93", "repo": "https://github.com/microsoft/vscode-js-debug-companion", "metadata": { "id": "99cb0b7f-7354-4278-b8da-6cc79972169d", "publisherId": { "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", "publisherName": "ms-vscode", "displayName": "Microsoft", "flags": "verified" }, "publisherDisplayName": "Microsoft" } }, { "name": "ms-vscode.js-debug", "version": "1.96.0", "sha256": "278cd8b129c133d834a8105d0e0699f2f940c5c159fa5c821c7b9a4f7ffd3581", "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": "rstudio.rstudio-workbench", "version": "1.5.28", "positUrl": "https://cdn.posit.co/pwb-components/extension", "type": "reh-web", "sha256": "a1052e6cf884977b68883950360d29b394acdbdd2a84f0b17a7cc9887436918f", "metadata": { "publisherDisplayName": "Posit PBC" } }], "extensionsGallery": { "serviceUrl": "https://open-vsx.org/vscode/gallery", "itemUrl": "https://open-vsx.org/vscode/item", "resourceUrlTemplate": "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}", "controlUrl": "", "recommendationsUrl": "" }, "linkProtectionTrustedDomains": ["https://open-vsx.org"], "version": "1.96.0", "commit": "b53f4ab975dd2f3b4cf7cd418ed669697450b40a", "date": "2025-02-18T16:54:01.014Z" };
      if (Object.keys(product).length === 0) {
        Object.assign(product, {
          version: "1.95.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"
        });
      }
    }
    product_default = product;
  }
});

// out-build/vs/platform/files/common/io.js
async function $ey(provider, resource, target, transformer, options2, token) {
  let error = void 0;
  try {
    await doReadFileIntoStream(provider, resource, target, transformer, options2, token);
  } catch (err) {
    error = err;
  } finally {
    if (error && options2.errorTransformer) {
      error = options2.errorTransformer(error);
    }
    if (typeof error !== "undefined") {
      target.error(error);
    }
    target.end();
  }
}
async function doReadFileIntoStream(provider, resource, target, transformer, options2, token) {
  throwIfCancelled(token);
  const handle = await provider.open(resource, { create: false });
  try {
    throwIfCancelled(token);
    let totalBytesRead = 0;
    let bytesRead = 0;
    let allowedRemainingBytes = options2 && typeof options2.length === "number" ? options2.length : void 0;
    let buffer = $Ci.alloc(Math.min(options2.bufferSize, typeof allowedRemainingBytes === "number" ? allowedRemainingBytes : options2.bufferSize));
    let posInFile = options2 && typeof options2.position === "number" ? options2.position : 0;
    let posInBuffer = 0;
    do {
      bytesRead = await provider.read(handle, posInFile, buffer.buffer, posInBuffer, buffer.byteLength - posInBuffer);
      posInFile += bytesRead;
      posInBuffer += bytesRead;
      totalBytesRead += bytesRead;
      if (typeof allowedRemainingBytes === "number") {
        allowedRemainingBytes -= bytesRead;
      }
      if (posInBuffer === buffer.byteLength) {
        await target.write(transformer(buffer));
        buffer = $Ci.alloc(Math.min(options2.bufferSize, typeof allowedRemainingBytes === "number" ? allowedRemainingBytes : options2.bufferSize));
        posInBuffer = 0;
      }
    } while (bytesRead > 0 && (typeof allowedRemainingBytes !== "number" || allowedRemainingBytes > 0) && throwIfCancelled(token) && throwIfTooLarge(totalBytesRead, options2));
    if (posInBuffer > 0) {
      let lastChunkLength = posInBuffer;
      if (typeof allowedRemainingBytes === "number") {
        lastChunkLength = Math.min(posInBuffer, allowedRemainingBytes);
      }
      target.write(transformer(buffer.slice(0, lastChunkLength)));
    }
  } catch (error) {
    throw $ym(error);
  } finally {
    await provider.close(handle);
  }
}
function throwIfCancelled(token) {
  if (token.isCancellationRequested) {
    throw $mb();
  }
  return true;
}
function throwIfTooLarge(totalBytesRead, options2) {
  if (typeof options2?.limits?.size === "number" && totalBytesRead > options2.limits.size) {
    throw $xm(localize(1943, null), FileSystemProviderErrorCode.FileTooLarge);
  }
  return true;
}
var init_io = __esm({
  "out-build/vs/platform/files/common/io.js"() {
    "use strict";
    init_buffer();
    init_errors();
    init_nls2();
    init_files();
  }
});

// out-build/vs/platform/files/common/fileService.js
var $7B_1, $7B;
var init_fileService = __esm({
  "out-build/vs/platform/files/common/fileService.js"() {
    "use strict";
    init_arrays();
    init_async();
    init_buffer();
    init_cancellation();
    init_event();
    init_hash();
    init_iterator();
    init_lifecycle();
    init_ternarySearchTree();
    init_network();
    init_performance();
    init_resources();
    init_stream();
    init_nls2();
    init_files();
    init_io();
    init_log();
    init_errors();
    $7B = class $7B2 extends $3c {
      static {
        $7B_1 = this;
      }
      constructor(b) {
        super();
        this.b = b;
        this.a = 256 * 1024;
        this.c = this.B(new $ze());
        this.onDidChangeFileSystemProviderRegistrations = this.c.event;
        this.f = this.B(new $ze());
        this.onWillActivateFileSystemProvider = this.f.event;
        this.g = this.B(new $ze());
        this.onDidChangeFileSystemProviderCapabilities = this.g.event;
        this.h = /* @__PURE__ */ new Map();
        this.r = this.B(new $ze());
        this.onDidRunOperation = this.r.event;
        this.X = this.B(new $ze());
        this.Y = this.B(new $ze());
        this.onDidFilesChange = this.Y.event;
        this.Z = this.B(new $ze());
        this.onDidWatchError = this.Z.event;
        this.$ = /* @__PURE__ */ new Map();
        this.cb = this.B(new $5h());
      }
      registerProvider(scheme, provider) {
        if (this.h.has(scheme)) {
          throw new Error(`A filesystem provider for the scheme '${scheme}' is already registered.`);
        }
        $S(`code/registerFilesystem/${scheme}`);
        const providerDisposables = new $2c();
        this.h.set(scheme, provider);
        this.c.fire({ added: true, scheme, provider });
        providerDisposables.add(provider.onDidChangeFile((changes) => {
          const event = new $Dm(changes, !this.S(provider));
          this.X.fire(event);
          if (!event.hasCorrelation()) {
            this.Y.fire(event);
          }
        }));
        if (typeof provider.onDidWatchError === "function") {
          providerDisposables.add(provider.onDidWatchError((error) => this.Z.fire(new Error(error))));
        }
        providerDisposables.add(provider.onDidChangeCapabilities(() => this.g.fire({ provider, scheme })));
        return $1c(() => {
          this.c.fire({ added: false, scheme, provider });
          this.h.delete(scheme);
          $Xc(providerDisposables);
        });
      }
      getProvider(scheme) {
        return this.h.get(scheme);
      }
      async activateProvider(scheme) {
        const joiners = [];
        this.f.fire({
          scheme,
          join(promise) {
            joiners.push(promise);
          }
        });
        if (this.h.has(scheme)) {
          return;
        }
        await Promises.settled(joiners);
      }
      async canHandleResource(resource) {
        await this.activateProvider(resource.scheme);
        return this.hasProvider(resource);
      }
      hasProvider(resource) {
        return this.h.has(resource.scheme);
      }
      hasCapability(resource, capability) {
        const provider = this.h.get(resource.scheme);
        return !!(provider && provider.capabilities & capability);
      }
      listCapabilities() {
        return Iterable.map(this.h, ([scheme, provider]) => ({ scheme, capabilities: provider.capabilities }));
      }
      async j(resource) {
        if (!$zh(resource)) {
          throw new $Fm(
            localize(1916, null, this.sb(resource)),
            8
            /* FileOperationResult.FILE_INVALID_PATH */
          );
        }
        await this.activateProvider(resource.scheme);
        const provider = this.h.get(resource.scheme);
        if (!provider) {
          const error = new $ub();
          error.message = localize(1917, null, resource.toString());
          throw error;
        }
        return provider;
      }
      async m(resource) {
        const provider = await this.j(resource);
        if ($qm(provider) || $nm(provider) || $rm(provider)) {
          return provider;
        }
        throw new Error(`Filesystem provider for scheme '${resource.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`);
      }
      async n(resource) {
        const provider = await this.j(resource);
        if ($qm(provider) || $nm(provider)) {
          return provider;
        }
        throw new Error(`Filesystem provider for scheme '${resource.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`);
      }
      async resolve(resource, options2) {
        try {
          return await this.s(resource, options2);
        } catch (error) {
          if ($Am(error) === FileSystemProviderErrorCode.FileNotFound) {
            throw new $Fm(
              localize(1918, null, this.sb(resource)),
              1
              /* FileOperationResult.FILE_NOT_FOUND */
            );
          }
          throw $ym(error);
        }
      }
      async s(resource, options2) {
        const provider = await this.j(resource);
        const isPathCaseSensitive = this.S(provider);
        const resolveTo = options2?.resolveTo;
        const resolveSingleChildDescendants = options2?.resolveSingleChildDescendants;
        const resolveMetadata = options2?.resolveMetadata;
        const stat = await provider.stat(resource);
        let trie;
        return this.t(provider, resource, stat, void 0, !!resolveMetadata, (stat2, siblings) => {
          if (!trie) {
            trie = $Wk.forUris(() => !isPathCaseSensitive);
            trie.set(resource, true);
            if (resolveTo) {
              trie.fill(true, resolveTo);
            }
          }
          if (trie.get(stat2.resource) || trie.findSuperstr(stat2.resource.with(
            { query: null, fragment: null }
            /* required for https://github.com/microsoft/vscode/issues/128151 */
          ))) {
            return true;
          }
          if (stat2.isDirectory && resolveSingleChildDescendants) {
            return siblings === 1;
          }
          return false;
        });
      }
      async t(provider, resource, stat, siblings, resolveMetadata, recurse) {
        const { providerExtUri } = this.R(provider);
        const fileStat = {
          resource,
          name: providerExtUri.basename(resource),
          isFile: (stat.type & FileType.File) !== 0,
          isDirectory: (stat.type & FileType.Directory) !== 0,
          isSymbolicLink: (stat.type & FileType.SymbolicLink) !== 0,
          mtime: stat.mtime,
          ctime: stat.ctime,
          size: stat.size,
          readonly: Boolean((stat.permissions ?? 0) & FilePermission.Readonly) || Boolean(
            provider.capabilities & 2048
            /* FileSystemProviderCapabilities.Readonly */
          ),
          locked: Boolean((stat.permissions ?? 0) & FilePermission.Locked),
          etag: $Qm({ mtime: stat.mtime, size: stat.size }),
          children: void 0
        };
        if (fileStat.isDirectory && recurse(fileStat, siblings)) {
          try {
            const entries = await provider.readdir(resource);
            const resolvedEntries = await Promises.settled(entries.map(async ([name, type2]) => {
              try {
                const childResource = providerExtUri.joinPath(resource, name);
                const childStat = resolveMetadata ? await provider.stat(childResource) : { type: type2 };
                return await this.t(provider, childResource, childStat, entries.length, resolveMetadata, recurse);
              } catch (error) {
                this.b.trace(error);
                return null;
              }
            }));
            fileStat.children = $Mb(resolvedEntries);
          } catch (error) {
            this.b.trace(error);
            fileStat.children = [];
          }
          return fileStat;
        }
        return fileStat;
      }
      async resolveAll(toResolve) {
        return Promises.settled(toResolve.map(async (entry) => {
          try {
            return { stat: await this.s(entry.resource, entry.options), success: true };
          } catch (error) {
            this.b.trace(error);
            return { stat: void 0, success: false };
          }
        }));
      }
      async stat(resource) {
        const provider = await this.j(resource);
        const stat = await provider.stat(resource);
        return this.t(
          provider,
          resource,
          stat,
          void 0,
          true,
          () => false
          /* Do not resolve any children */
        );
      }
      async exists(resource) {
        const provider = await this.j(resource);
        try {
          const stat = await provider.stat(resource);
          return !!stat;
        } catch (error) {
          return false;
        }
      }
      //#endregion
      //#region File Reading/Writing
      async canCreateFile(resource, options2) {
        try {
          await this.u(resource, options2);
        } catch (error) {
          return error;
        }
        return true;
      }
      async u(resource, options2) {
        if (!options2?.overwrite && await this.exists(resource)) {
          throw new $Fm(localize(1919, null, this.sb(resource)), 3, options2);
        }
      }
      async createFile(resource, bufferOrReadableOrStream = $Ci.fromString(""), options2) {
        await this.u(resource, options2);
        const fileStat = await this.writeFile(resource, bufferOrReadableOrStream);
        this.r.fire(new $Cm(resource, 0, fileStat));
        return fileStat;
      }
      async writeFile(resource, bufferOrReadableOrStream, options2) {
        const provider = this.qb(await this.n(resource), resource);
        const { providerExtUri } = this.R(provider);
        let writeFileOptions = options2;
        if ($tm(provider) && !writeFileOptions?.atomic) {
          const enforcedAtomicWrite = provider.enforceAtomicWriteFile?.(resource);
          if (enforcedAtomicWrite) {
            writeFileOptions = { ...options2, atomic: enforcedAtomicWrite };
          }
        }
        try {
          const stat = await this.w(provider, resource, writeFileOptions);
          if (!stat) {
            await this.U(provider, providerExtUri.dirname(resource));
          }
          let bufferOrReadableOrStreamOrBufferedStream;
          if ($nm(provider) && !(bufferOrReadableOrStream instanceof $Ci)) {
            if ($oi(bufferOrReadableOrStream)) {
              const bufferedStream = await $vi(bufferOrReadableOrStream, 3);
              if (bufferedStream.ended) {
                bufferOrReadableOrStreamOrBufferedStream = $Ci.concat(bufferedStream.buffer);
              } else {
                bufferOrReadableOrStreamOrBufferedStream = bufferedStream;
              }
            } else {
              bufferOrReadableOrStreamOrBufferedStream = $si(bufferOrReadableOrStream, (data) => $Ci.concat(data), 3);
            }
          } else {
            bufferOrReadableOrStreamOrBufferedStream = bufferOrReadableOrStream;
          }
          if (!$qm(provider) || // buffered writing is unsupported
          $nm(provider) && bufferOrReadableOrStreamOrBufferedStream instanceof $Ci || // data is a full buffer already
          $nm(provider) && $tm(provider) && writeFileOptions?.atomic) {
            await this.hb(provider, resource, writeFileOptions, bufferOrReadableOrStreamOrBufferedStream);
          } else {
            await this.db(provider, resource, writeFileOptions, bufferOrReadableOrStreamOrBufferedStream instanceof $Ci ? $Ni(bufferOrReadableOrStreamOrBufferedStream) : bufferOrReadableOrStreamOrBufferedStream);
          }
          this.r.fire(new $Cm(
            resource,
            4
            /* FileOperation.WRITE */
          ));
        } catch (error) {
          throw new $Fm(localize(1920, null, this.sb(resource), $ym(error).toString()), $Bm(error), writeFileOptions);
        }
        return this.resolve(resource, { resolveMetadata: true });
      }
      async w(provider, resource, options2) {
        const unlock = !!options2?.unlock;
        if (unlock && !(provider.capabilities & 8192)) {
          throw new Error(localize(1921, null, this.sb(resource)));
        }
        const atomic = !!options2?.atomic;
        if (atomic) {
          if (!(provider.capabilities & 32768)) {
            throw new Error(localize(1922, null, this.sb(resource)));
          }
          if (!(provider.capabilities & 2)) {
            throw new Error(localize(1923, null, this.sb(resource)));
          }
          if (unlock) {
            throw new Error(localize(1924, null, this.sb(resource)));
          }
        }
        let stat = void 0;
        try {
          stat = await provider.stat(resource);
        } catch (error) {
          return void 0;
        }
        if ((stat.type & FileType.Directory) !== 0) {
          throw new $Fm(localize(1925, null, this.sb(resource)), 0, options2);
        }
        this.rb(resource, stat);
        if (typeof options2?.mtime === "number" && typeof options2.etag === "string" && options2.etag !== $Pm && typeof stat.mtime === "number" && typeof stat.size === "number" && options2.mtime < stat.mtime && options2.etag !== $Qm({ mtime: options2.mtime, size: stat.size })) {
          throw new $Fm(localize(1926, null), 3, options2);
        }
        return stat;
      }
      async readFile(resource, options2, token) {
        const provider = await this.m(resource);
        if (options2?.atomic) {
          return this.z(provider, resource, options2, token);
        }
        return this.C(provider, resource, options2, token);
      }
      async z(provider, resource, options2, token) {
        return new Promise((resolve4, reject) => {
          this.cb.queueFor(resource, async () => {
            try {
              const content = await this.C(provider, resource, options2, token);
              resolve4(content);
            } catch (error) {
              reject(error);
            }
          }, this.R(provider).providerExtUri);
        });
      }
      async C(provider, resource, options2, token) {
        const stream = await this.D(provider, resource, {
          ...options2,
          // optimization: since we know that the caller does not
          // care about buffering, we indicate this to the reader.
          // this reduces all the overhead the buffered reading
          // has (open, read, close) if the provider supports
          // unbuffered reading.
          preferUnbuffered: true
        }, token);
        return {
          ...stream,
          value: await $Oi(stream.value)
        };
      }
      async readFileStream(resource, options2, token) {
        const provider = await this.m(resource);
        return this.D(provider, resource, options2, token);
      }
      async D(provider, resource, options2, token) {
        const cancellableSource = new $ad(token);
        let readFileOptions = options2;
        if ($sm(provider) && provider.enforceAtomicReadFile?.(resource)) {
          readFileOptions = { ...options2, atomic: true };
        }
        const statPromise = this.J(resource, readFileOptions).then((stat) => stat, (error) => {
          cancellableSource.dispose(true);
          throw error;
        });
        let fileStream = void 0;
        try {
          if (typeof readFileOptions?.etag === "string" && readFileOptions.etag !== $Pm) {
            await statPromise;
          }
          if (readFileOptions?.atomic && $sm(provider) || // atomic reads are always unbuffered
          !($qm(provider) || $rm(provider)) || // provider has no buffered capability
          $nm(provider) && readFileOptions?.preferUnbuffered) {
            fileStream = this.I(provider, resource, readFileOptions);
          } else if ($rm(provider)) {
            fileStream = this.G(provider, resource, cancellableSource.token, readFileOptions);
          } else {
            fileStream = this.H(provider, resource, cancellableSource.token, readFileOptions);
          }
          fileStream.on("end", () => cancellableSource.dispose());
          fileStream.on("error", () => cancellableSource.dispose());
          const fileStat = await statPromise;
          return {
            ...fileStat,
            value: fileStream
          };
        } catch (error) {
          if (fileStream) {
            await $ti(fileStream);
          }
          throw this.F(error, resource, readFileOptions);
        }
      }
      F(error, resource, options2) {
        const message = localize(1927, null, this.sb(resource), $ym(error).toString());
        if (error instanceof $Hm) {
          return new $Hm(message, error.stat, options2);
        }
        if (error instanceof $Gm) {
          return new $Gm(message, error.fileOperationResult, error.size, error.options);
        }
        return new $Fm(message, $Bm(error), options2);
      }
      G(provider, resource, token, options2 = /* @__PURE__ */ Object.create(null)) {
        const fileStream = provider.readFileStream(resource, options2, token);
        return $zi(fileStream, {
          data: (data) => data instanceof $Ci ? data : $Ci.wrap(data),
          error: (error) => this.F(error, resource, options2)
        }, (data) => $Ci.concat(data));
      }
      H(provider, resource, token, options2 = /* @__PURE__ */ Object.create(null)) {
        const stream = $Si();
        $ey(provider, resource, stream, (data) => data, {
          ...options2,
          bufferSize: this.a,
          errorTransformer: (error) => this.F(error, resource, options2)
        }, token);
        return stream;
      }
      I(provider, resource, options2) {
        const stream = $qi((data) => $Ci.concat(data));
        (async () => {
          try {
            let buffer;
            if (options2?.atomic && $sm(provider)) {
              buffer = await provider.readFile(resource, { atomic: true });
            } else {
              buffer = await provider.readFile(resource);
            }
            if (typeof options2?.position === "number") {
              buffer = buffer.slice(options2.position);
            }
            if (typeof options2?.length === "number") {
              buffer = buffer.slice(0, options2.length);
            }
            this.L(resource, buffer.byteLength, options2);
            stream.end($Ci.wrap(buffer));
          } catch (err) {
            stream.error(err);
            stream.end();
          }
        })();
        return stream;
      }
      async J(resource, options2) {
        const stat = await this.resolve(resource, { resolveMetadata: true });
        if (stat.isDirectory) {
          throw new $Fm(localize(1928, null, this.sb(resource)), 0, options2);
        }
        if (typeof options2?.etag === "string" && options2.etag !== $Pm && options2.etag === stat.etag) {
          throw new $Hm(localize(1929, null), stat, options2);
        }
        this.L(resource, stat.size, options2);
        return stat;
      }
      L(resource, size, options2) {
        if (typeof options2?.limits?.size === "number" && size > options2.limits.size) {
          throw new $Gm(localize(1930, null, this.sb(resource)), 7, size, options2);
        }
      }
      //#endregion
      //#region Move/Copy/Delete/Create Folder
      async canMove(source, target, overwrite) {
        return this.M(source, target, "move", overwrite);
      }
      async canCopy(source, target, overwrite) {
        return this.M(source, target, "copy", overwrite);
      }
      async M(source, target, mode, overwrite) {
        if (source.toString() !== target.toString()) {
          try {
            const sourceProvider = mode === "move" ? this.qb(await this.n(source), source) : await this.m(source);
            const targetProvider = this.qb(await this.n(target), target);
            await this.Q(sourceProvider, source, targetProvider, target, mode, overwrite);
          } catch (error) {
            return error;
          }
        }
        return true;
      }
      async move(source, target, overwrite) {
        const sourceProvider = this.qb(await this.n(source), source);
        const targetProvider = this.qb(await this.n(target), target);
        const mode = await this.N(sourceProvider, source, targetProvider, target, "move", !!overwrite);
        const fileStat = await this.resolve(target, { resolveMetadata: true });
        this.r.fire(new $Cm(source, mode === "move" ? 2 : 3, fileStat));
        return fileStat;
      }
      async copy(source, target, overwrite) {
        const sourceProvider = await this.m(source);
        const targetProvider = this.qb(await this.n(target), target);
        const mode = await this.N(sourceProvider, source, targetProvider, target, "copy", !!overwrite);
        const fileStat = await this.resolve(target, { resolveMetadata: true });
        this.r.fire(new $Cm(source, mode === "copy" ? 3 : 2, fileStat));
        return fileStat;
      }
      async N(sourceProvider, source, targetProvider, target, mode, overwrite) {
        if (source.toString() === target.toString()) {
          return mode;
        }
        const { exists: exists2, isSameResourceWithDifferentPathCase } = await this.Q(sourceProvider, source, targetProvider, target, mode, overwrite);
        if (exists2 && !isSameResourceWithDifferentPathCase && overwrite) {
          await this.del(target, { recursive: true });
        }
        await this.U(targetProvider, this.R(targetProvider).providerExtUri.dirname(target));
        if (mode === "copy") {
          if (sourceProvider === targetProvider && $om(sourceProvider)) {
            await sourceProvider.copy(source, target, { overwrite });
          } else {
            const sourceFile = await this.resolve(source);
            if (sourceFile.isDirectory) {
              await this.P(sourceProvider, sourceFile, targetProvider, target);
            } else {
              await this.O(sourceProvider, source, targetProvider, target);
            }
          }
          return mode;
        } else {
          if (sourceProvider === targetProvider) {
            await sourceProvider.rename(source, target, { overwrite });
            return mode;
          } else {
            await this.N(sourceProvider, source, targetProvider, target, "copy", overwrite);
            await this.del(source, { recursive: true });
            return "copy";
          }
        }
      }
      async O(sourceProvider, source, targetProvider, target) {
        if ($qm(sourceProvider) && $qm(targetProvider)) {
          return this.jb(sourceProvider, source, targetProvider, target);
        }
        if ($qm(sourceProvider) && $nm(targetProvider)) {
          return this.pb(sourceProvider, source, targetProvider, target);
        }
        if ($nm(sourceProvider) && $qm(targetProvider)) {
          return this.nb(sourceProvider, source, targetProvider, target);
        }
        if ($nm(sourceProvider) && $nm(targetProvider)) {
          return this.lb(sourceProvider, source, targetProvider, target);
        }
      }
      async P(sourceProvider, sourceFolder, targetProvider, targetFolder) {
        await targetProvider.mkdir(targetFolder);
        if (Array.isArray(sourceFolder.children)) {
          await Promises.settled(sourceFolder.children.map(async (sourceChild) => {
            const targetChild = this.R(targetProvider).providerExtUri.joinPath(targetFolder, sourceChild.name);
            if (sourceChild.isDirectory) {
              return this.P(sourceProvider, await this.resolve(sourceChild.resource), targetProvider, targetChild);
            } else {
              return this.O(sourceProvider, sourceChild.resource, targetProvider, targetChild);
            }
          }));
        }
      }
      async Q(sourceProvider, source, targetProvider, target, mode, overwrite) {
        let isSameResourceWithDifferentPathCase = false;
        if (sourceProvider === targetProvider) {
          const { providerExtUri, isPathCaseSensitive } = this.R(sourceProvider);
          if (!isPathCaseSensitive) {
            isSameResourceWithDifferentPathCase = providerExtUri.isEqual(source, target);
          }
          if (isSameResourceWithDifferentPathCase && mode === "copy") {
            throw new Error(localize(1931, null, this.sb(source), this.sb(target)));
          }
          if (!isSameResourceWithDifferentPathCase && providerExtUri.isEqualOrParent(target, source)) {
            throw new Error(localize(1932, null, this.sb(source), this.sb(target)));
          }
        }
        const exists2 = await this.exists(target);
        if (exists2 && !isSameResourceWithDifferentPathCase) {
          if (!overwrite) {
            throw new $Fm(
              localize(1933, null, this.sb(source), this.sb(target)),
              4
              /* FileOperationResult.FILE_MOVE_CONFLICT */
            );
          }
          if (sourceProvider === targetProvider) {
            const { providerExtUri } = this.R(sourceProvider);
            if (providerExtUri.isEqualOrParent(source, target)) {
              throw new Error(localize(1934, null, this.sb(source), this.sb(target)));
            }
          }
        }
        return { exists: exists2, isSameResourceWithDifferentPathCase };
      }
      R(provider) {
        const isPathCaseSensitive = this.S(provider);
        return {
          providerExtUri: isPathCaseSensitive ? $lh : $nh,
          isPathCaseSensitive
        };
      }
      S(provider) {
        return !!(provider.capabilities & 1024);
      }
      async createFolder(resource) {
        const provider = this.qb(await this.j(resource), resource);
        await this.U(provider, resource);
        const fileStat = await this.resolve(resource, { resolveMetadata: true });
        this.r.fire(new $Cm(resource, 0, fileStat));
        return fileStat;
      }
      async U(provider, directory) {
        const directoriesToCreate = [];
        const { providerExtUri } = this.R(provider);
        while (!providerExtUri.isEqual(directory, providerExtUri.dirname(directory))) {
          try {
            const stat = await provider.stat(directory);
            if ((stat.type & FileType.Directory) === 0) {
              throw new Error(localize(1935, null, this.sb(directory)));
            }
            break;
          } catch (error) {
            if ($Am(error) !== FileSystemProviderErrorCode.FileNotFound) {
              throw error;
            }
            directoriesToCreate.push(providerExtUri.basename(directory));
            directory = providerExtUri.dirname(directory);
          }
        }
        for (let i = directoriesToCreate.length - 1; i >= 0; i--) {
          directory = providerExtUri.joinPath(directory, directoriesToCreate[i]);
          try {
            await provider.mkdir(directory);
          } catch (error) {
            if ($Am(error) !== FileSystemProviderErrorCode.FileExists) {
              throw error;
            }
          }
        }
      }
      async canDelete(resource, options2) {
        try {
          await this.W(resource, options2);
        } catch (error) {
          return error;
        }
        return true;
      }
      async W(resource, options2) {
        const provider = this.qb(await this.j(resource), resource);
        const useTrash = !!options2?.useTrash;
        if (useTrash && !(provider.capabilities & 4096)) {
          throw new Error(localize(1936, null, this.sb(resource)));
        }
        const atomic = options2?.atomic;
        if (atomic && !(provider.capabilities & 65536)) {
          throw new Error(localize(1937, null, this.sb(resource)));
        }
        if (useTrash && atomic) {
          throw new Error(localize(1938, null, this.sb(resource)));
        }
        let stat = void 0;
        try {
          stat = await provider.stat(resource);
        } catch (error) {
        }
        if (stat) {
          this.rb(resource, stat);
        } else {
          throw new $Fm(
            localize(1939, null, this.sb(resource)),
            1
            /* FileOperationResult.FILE_NOT_FOUND */
          );
        }
        const recursive = !!options2?.recursive;
        if (!recursive) {
          const stat2 = await this.resolve(resource);
          if (stat2.isDirectory && Array.isArray(stat2.children) && stat2.children.length > 0) {
            throw new Error(localize(1940, null, this.sb(resource)));
          }
        }
        return provider;
      }
      async del(resource, options2) {
        const provider = await this.W(resource, options2);
        let deleteFileOptions = options2;
        if ($um(provider) && !deleteFileOptions?.atomic) {
          const enforcedAtomicDelete = provider.enforceAtomicDelete?.(resource);
          if (enforcedAtomicDelete) {
            deleteFileOptions = { ...options2, atomic: enforcedAtomicDelete };
          }
        }
        const useTrash = !!deleteFileOptions?.useTrash;
        const recursive = !!deleteFileOptions?.recursive;
        const atomic = deleteFileOptions?.atomic ?? false;
        await provider.delete(resource, { recursive, useTrash, atomic });
        this.r.fire(new $Cm(
          resource,
          1
          /* FileOperation.DELETE */
        ));
      }
      //#endregion
      //#region Clone File
      async cloneFile(source, target) {
        const sourceProvider = await this.j(source);
        const targetProvider = this.qb(await this.n(target), target);
        if (sourceProvider === targetProvider && this.R(sourceProvider).providerExtUri.isEqual(source, target)) {
          return;
        }
        if (sourceProvider === targetProvider && $pm(sourceProvider)) {
          return sourceProvider.cloneFile(source, target);
        }
        await this.U(targetProvider, this.R(targetProvider).providerExtUri.dirname(target));
        if (sourceProvider === targetProvider && $om(sourceProvider)) {
          return this.cb.queueFor(source, () => sourceProvider.copy(source, target, { overwrite: true }), this.R(sourceProvider).providerExtUri);
        }
        return this.cb.queueFor(source, () => this.O(sourceProvider, source, targetProvider, target), this.R(sourceProvider).providerExtUri);
      }
      static {
        this.ab = 0;
      }
      createWatcher(resource, options2) {
        return this.watch(resource, {
          ...options2,
          // Explicitly set a correlation id so that file events that originate
          // from requests from extensions are exclusively routed back to the
          // extension host and not into the workbench.
          correlationId: $7B_1.ab++
        });
      }
      watch(resource, options2 = { recursive: false, excludes: [] }) {
        const disposables = new $2c();
        let watchDisposed = false;
        let disposeWatch = () => {
          watchDisposed = true;
        };
        disposables.add($1c(() => disposeWatch()));
        (async () => {
          try {
            const disposable = await this.bb(resource, options2);
            if (watchDisposed) {
              $Xc(disposable);
            } else {
              disposeWatch = () => $Xc(disposable);
            }
          } catch (error) {
            this.b.error(error);
          }
        })();
        const correlationId = options2.correlationId;
        if (typeof correlationId === "number") {
          const fileChangeEmitter = disposables.add(new $ze());
          disposables.add(this.X.event((e) => {
            if (e.correlates(correlationId)) {
              fileChangeEmitter.fire(e);
            }
          }));
          const watcher = {
            onDidChange: fileChangeEmitter.event,
            dispose: () => disposables.dispose()
          };
          return watcher;
        }
        return disposables;
      }
      async bb(resource, options2) {
        const provider = await this.j(resource);
        const watchHash = $Xi([this.R(provider).providerExtUri.getComparisonKey(resource), options2]);
        let watcher = this.$.get(watchHash);
        if (!watcher) {
          watcher = {
            count: 0,
            disposable: provider.watch(resource, options2)
          };
          this.$.set(watchHash, watcher);
        }
        watcher.count += 1;
        return $1c(() => {
          if (watcher) {
            watcher.count--;
            if (watcher.count === 0) {
              $Xc(watcher.disposable);
              this.$.delete(watchHash);
            }
          }
        });
      }
      dispose() {
        super.dispose();
        for (const [, watcher] of this.$) {
          $Xc(watcher.disposable);
        }
        this.$.clear();
      }
      async db(provider, resource, options2, readableOrStreamOrBufferedStream) {
        return this.cb.queueFor(resource, async () => {
          const handle = await provider.open(resource, { create: true, unlock: options2?.unlock ?? false });
          try {
            if ($oi(readableOrStreamOrBufferedStream) || $pi(readableOrStreamOrBufferedStream)) {
              await this.eb(provider, handle, readableOrStreamOrBufferedStream);
            } else {
              await this.fb(provider, handle, readableOrStreamOrBufferedStream);
            }
          } catch (error) {
            throw $ym(error);
          } finally {
            await provider.close(handle);
          }
        }, this.R(provider).providerExtUri);
      }
      async eb(provider, handle, streamOrBufferedStream) {
        let posInFile = 0;
        let stream;
        if ($pi(streamOrBufferedStream)) {
          if (streamOrBufferedStream.buffer.length > 0) {
            const chunk = $Ci.concat(streamOrBufferedStream.buffer);
            await this.gb(provider, handle, chunk, chunk.byteLength, posInFile, 0);
            posInFile += chunk.byteLength;
          }
          if (streamOrBufferedStream.ended) {
            return;
          }
          stream = streamOrBufferedStream.stream;
        } else {
          stream = streamOrBufferedStream;
        }
        return new Promise((resolve4, reject) => {
          $ui(stream, {
            onData: async (chunk) => {
              stream.pause();
              try {
                await this.gb(provider, handle, chunk, chunk.byteLength, posInFile, 0);
              } catch (error) {
                return reject(error);
              }
              posInFile += chunk.byteLength;
              setTimeout(() => stream.resume());
            },
            onError: (error) => reject(error),
            onEnd: () => resolve4()
          });
        });
      }
      async fb(provider, handle, readable) {
        let posInFile = 0;
        let chunk;
        while ((chunk = readable.read()) !== null) {
          await this.gb(provider, handle, chunk, chunk.byteLength, posInFile, 0);
          posInFile += chunk.byteLength;
        }
      }
      async gb(provider, handle, buffer, length, posInFile, posInBuffer) {
        let totalBytesWritten = 0;
        while (totalBytesWritten < length) {
          const bytesWritten = await provider.write(handle, posInFile + totalBytesWritten, buffer.buffer, posInBuffer + totalBytesWritten, length - totalBytesWritten);
          totalBytesWritten += bytesWritten;
        }
      }
      async hb(provider, resource, options2, bufferOrReadableOrStreamOrBufferedStream) {
        return this.cb.queueFor(resource, () => this.ib(provider, resource, options2, bufferOrReadableOrStreamOrBufferedStream), this.R(provider).providerExtUri);
      }
      async ib(provider, resource, options2, bufferOrReadableOrStreamOrBufferedStream) {
        let buffer;
        if (bufferOrReadableOrStreamOrBufferedStream instanceof $Ci) {
          buffer = bufferOrReadableOrStreamOrBufferedStream;
        } else if ($oi(bufferOrReadableOrStreamOrBufferedStream)) {
          buffer = await $Oi(bufferOrReadableOrStreamOrBufferedStream);
        } else if ($pi(bufferOrReadableOrStreamOrBufferedStream)) {
          buffer = await $Pi(bufferOrReadableOrStreamOrBufferedStream);
        } else {
          buffer = $Mi(bufferOrReadableOrStreamOrBufferedStream);
        }
        await provider.writeFile(resource, buffer.buffer, { create: true, overwrite: true, unlock: options2?.unlock ?? false, atomic: options2?.atomic ?? false });
      }
      async jb(sourceProvider, source, targetProvider, target) {
        return this.cb.queueFor(target, () => this.kb(sourceProvider, source, targetProvider, target), this.R(targetProvider).providerExtUri);
      }
      async kb(sourceProvider, source, targetProvider, target) {
        let sourceHandle = void 0;
        let targetHandle = void 0;
        try {
          sourceHandle = await sourceProvider.open(source, { create: false });
          targetHandle = await targetProvider.open(target, { create: true, unlock: false });
          const buffer = $Ci.alloc(this.a);
          let posInFile = 0;
          let posInBuffer = 0;
          let bytesRead = 0;
          do {
            bytesRead = await sourceProvider.read(sourceHandle, posInFile, buffer.buffer, posInBuffer, buffer.byteLength - posInBuffer);
            await this.gb(targetProvider, targetHandle, buffer, bytesRead, posInFile, posInBuffer);
            posInFile += bytesRead;
            posInBuffer += bytesRead;
            if (posInBuffer === buffer.byteLength) {
              posInBuffer = 0;
            }
          } while (bytesRead > 0);
        } catch (error) {
          throw $ym(error);
        } finally {
          await Promises.settled([
            typeof sourceHandle === "number" ? sourceProvider.close(sourceHandle) : Promise.resolve(),
            typeof targetHandle === "number" ? targetProvider.close(targetHandle) : Promise.resolve()
          ]);
        }
      }
      async lb(sourceProvider, source, targetProvider, target) {
        return this.cb.queueFor(target, () => this.mb(sourceProvider, source, targetProvider, target), this.R(targetProvider).providerExtUri);
      }
      async mb(sourceProvider, source, targetProvider, target) {
        return targetProvider.writeFile(target, await sourceProvider.readFile(source), { create: true, overwrite: true, unlock: false, atomic: false });
      }
      async nb(sourceProvider, source, targetProvider, target) {
        return this.cb.queueFor(target, () => this.ob(sourceProvider, source, targetProvider, target), this.R(targetProvider).providerExtUri);
      }
      async ob(sourceProvider, source, targetProvider, target) {
        const targetHandle = await targetProvider.open(target, { create: true, unlock: false });
        try {
          const buffer = await sourceProvider.readFile(source);
          await this.gb(targetProvider, targetHandle, $Ci.wrap(buffer), buffer.byteLength, 0, 0);
        } catch (error) {
          throw $ym(error);
        } finally {
          await targetProvider.close(targetHandle);
        }
      }
      async pb(sourceProvider, source, targetProvider, target) {
        const buffer = await $Oi(this.H(sourceProvider, source, CancellationToken.None));
        await this.hb(targetProvider, target, void 0, buffer);
      }
      qb(provider, resource) {
        if (provider.capabilities & 2048) {
          throw new $Fm(
            localize(1941, null, this.sb(resource)),
            6
            /* FileOperationResult.FILE_PERMISSION_DENIED */
          );
        }
        return provider;
      }
      rb(resource, stat) {
        if ((stat.permissions ?? 0) & FilePermission.Readonly) {
          throw new $Fm(
            localize(1942, null, this.sb(resource)),
            6
            /* FileOperationResult.FILE_PERMISSION_DENIED */
          );
        }
      }
      sb(resource) {
        if (resource.scheme === Schemas.file) {
          return resource.fsPath;
        }
        return resource.toString(true);
      }
    };
    $7B = $7B_1 = __decorate([
      __param(0, $wn)
    ], $7B);
  }
});

// out-build/vs/base/common/glob.js
function starsToRegExp(starCount, isLastPattern) {
  switch (starCount) {
    case 0:
      return "";
    case 1:
      return `${NO_PATH_REGEX}*?`;
    default:
      return `(?:${PATH_REGEX}|${NO_PATH_REGEX}+${PATH_REGEX}${isLastPattern ? `|${PATH_REGEX}${NO_PATH_REGEX}+` : ""})*?`;
  }
}
function $Bl(pattern, splitChar) {
  if (!pattern) {
    return [];
  }
  const segments = [];
  let inBraces = false;
  let inBrackets = false;
  let curVal = "";
  for (const char of pattern) {
    switch (char) {
      case splitChar:
        if (!inBraces && !inBrackets) {
          segments.push(curVal);
          curVal = "";
          continue;
        }
        break;
      case "{":
        inBraces = true;
        break;
      case "}":
        inBraces = false;
        break;
      case "[":
        inBrackets = true;
        break;
      case "]":
        inBrackets = false;
        break;
    }
    curVal += char;
  }
  if (curVal) {
    segments.push(curVal);
  }
  return segments;
}
function parseRegExp(pattern) {
  if (!pattern) {
    return "";
  }
  let regEx = "";
  const segments = $Bl(pattern, $Al);
  if (segments.every((segment) => segment === $zl)) {
    regEx = ".*";
  } else {
    let previousSegmentWasGlobStar = false;
    segments.forEach((segment, index) => {
      if (segment === $zl) {
        if (previousSegmentWasGlobStar) {
          return;
        }
        regEx += starsToRegExp(2, index === segments.length - 1);
      } else {
        let inBraces = false;
        let braceVal = "";
        let inBrackets = false;
        let bracketVal = "";
        for (const char of segment) {
          if (char !== "}" && inBraces) {
            braceVal += char;
            continue;
          }
          if (inBrackets && (char !== "]" || !bracketVal)) {
            let res;
            if (char === "-") {
              res = char;
            } else if ((char === "^" || char === "!") && !bracketVal) {
              res = "^";
            } else if (char === $Al) {
              res = "";
            } else {
              res = $Af(char);
            }
            bracketVal += res;
            continue;
          }
          switch (char) {
            case "{":
              inBraces = true;
              continue;
            case "[":
              inBrackets = true;
              continue;
            case "}": {
              const choices = $Bl(braceVal, ",");
              const braceRegExp = `(?:${choices.map((choice) => parseRegExp(choice)).join("|")})`;
              regEx += braceRegExp;
              inBraces = false;
              braceVal = "";
              break;
            }
            case "]": {
              regEx += "[" + bracketVal + "]";
              inBrackets = false;
              bracketVal = "";
              break;
            }
            case "?":
              regEx += NO_PATH_REGEX;
              continue;
            case "*":
              regEx += starsToRegExp(1);
              continue;
            default:
              regEx += $Af(char);
          }
        }
        if (index < segments.length - 1 && // more segments to come after this
        (segments[index + 1] !== $zl || // next segment is not **, or...
        index + 2 < segments.length)) {
          regEx += PATH_REGEX;
        }
      }
      previousSegmentWasGlobStar = segment === $zl;
    });
  }
  return regEx;
}
function parsePattern(arg1, options2) {
  if (!arg1) {
    return NULL;
  }
  let pattern;
  if (typeof arg1 !== "string") {
    pattern = arg1.pattern;
  } else {
    pattern = arg1;
  }
  pattern = pattern.trim();
  const patternKey = `${pattern}_${!!options2.trimForExclusions}`;
  let parsedPattern = CACHE.get(patternKey);
  if (parsedPattern) {
    return wrapRelativePattern(parsedPattern, arg1);
  }
  let match;
  if (T1.test(pattern)) {
    parsedPattern = trivia1(pattern.substr(4), pattern);
  } else if (match = T2.exec(trimForExclusions(pattern, options2))) {
    parsedPattern = trivia2(match[1], pattern);
  } else if ((options2.trimForExclusions ? T3_2 : T3).test(pattern)) {
    parsedPattern = trivia3(pattern, options2);
  } else if (match = T4.exec(trimForExclusions(pattern, options2))) {
    parsedPattern = trivia4and5(match[1].substr(1), pattern, true);
  } else if (match = T5.exec(trimForExclusions(pattern, options2))) {
    parsedPattern = trivia4and5(match[1], pattern, false);
  } else {
    parsedPattern = toRegExp(pattern);
  }
  CACHE.set(patternKey, parsedPattern);
  return wrapRelativePattern(parsedPattern, arg1);
}
function wrapRelativePattern(parsedPattern, arg2) {
  if (typeof arg2 === "string") {
    return parsedPattern;
  }
  const wrappedPattern = function(path7, basename) {
    if (!$Zg(path7, arg2.base, !$n)) {
      return null;
    }
    return parsedPattern($Ff(path7.substr(arg2.base.length), sep), basename);
  };
  wrappedPattern.allBasenames = parsedPattern.allBasenames;
  wrappedPattern.allPaths = parsedPattern.allPaths;
  wrappedPattern.basenames = parsedPattern.basenames;
  wrappedPattern.patterns = parsedPattern.patterns;
  return wrappedPattern;
}
function trimForExclusions(pattern, options2) {
  return options2.trimForExclusions && pattern.endsWith("/**") ? pattern.substr(0, pattern.length - 2) : pattern;
}
function trivia1(base, pattern) {
  return function(path7, basename) {
    return typeof path7 === "string" && path7.endsWith(base) ? pattern : null;
  };
}
function trivia2(base, pattern) {
  const slashBase = `/${base}`;
  const backslashBase = `\\${base}`;
  const parsedPattern = function(path7, basename) {
    if (typeof path7 !== "string") {
      return null;
    }
    if (basename) {
      return basename === base ? pattern : null;
    }
    return path7 === base || path7.endsWith(slashBase) || path7.endsWith(backslashBase) ? pattern : null;
  };
  const basenames = [base];
  parsedPattern.basenames = basenames;
  parsedPattern.patterns = [pattern];
  parsedPattern.allBasenames = basenames;
  return parsedPattern;
}
function trivia3(pattern, options2) {
  const parsedPatterns = aggregateBasenameMatches(pattern.slice(1, -1).split(",").map((pattern2) => parsePattern(pattern2, options2)).filter((pattern2) => pattern2 !== NULL), pattern);
  const patternsLength = parsedPatterns.length;
  if (!patternsLength) {
    return NULL;
  }
  if (patternsLength === 1) {
    return parsedPatterns[0];
  }
  const parsedPattern = function(path7, basename) {
    for (let i = 0, n = parsedPatterns.length; i < n; i++) {
      if (parsedPatterns[i](path7, basename)) {
        return pattern;
      }
    }
    return null;
  };
  const withBasenames = parsedPatterns.find((pattern2) => !!pattern2.allBasenames);
  if (withBasenames) {
    parsedPattern.allBasenames = withBasenames.allBasenames;
  }
  const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []);
  if (allPaths.length) {
    parsedPattern.allPaths = allPaths;
  }
  return parsedPattern;
}
function trivia4and5(targetPath, pattern, matchPathEnds) {
  const usingPosixSep = sep === $kc.sep;
  const nativePath = usingPosixSep ? targetPath : targetPath.replace(ALL_FORWARD_SLASHES, sep);
  const nativePathEnd = sep + nativePath;
  const targetPathEnd = $kc.sep + targetPath;
  let parsedPattern;
  if (matchPathEnds) {
    parsedPattern = function(path7, basename) {
      return typeof path7 === "string" && (path7 === nativePath || path7.endsWith(nativePathEnd) || !usingPosixSep && (path7 === targetPath || path7.endsWith(targetPathEnd))) ? pattern : null;
    };
  } else {
    parsedPattern = function(path7, basename) {
      return typeof path7 === "string" && (path7 === nativePath || !usingPosixSep && path7 === targetPath) ? pattern : null;
    };
  }
  parsedPattern.allPaths = [(matchPathEnds ? "*/" : "./") + targetPath];
  return parsedPattern;
}
function toRegExp(pattern) {
  try {
    const regExp = new RegExp(`^${parseRegExp(pattern)}$`);
    return function(path7) {
      regExp.lastIndex = 0;
      return typeof path7 === "string" && regExp.test(path7) ? pattern : null;
    };
  } catch (error) {
    return NULL;
  }
}
function $Dl(arg1, options2 = {}) {
  if (!arg1) {
    return FALSE;
  }
  if (typeof arg1 === "string" || $El(arg1)) {
    const parsedPattern = parsePattern(arg1, options2);
    if (parsedPattern === NULL) {
      return FALSE;
    }
    const resultPattern = function(path7, basename) {
      return !!parsedPattern(path7, basename);
    };
    if (parsedPattern.allBasenames) {
      resultPattern.allBasenames = parsedPattern.allBasenames;
    }
    if (parsedPattern.allPaths) {
      resultPattern.allPaths = parsedPattern.allPaths;
    }
    return resultPattern;
  }
  return parsedExpression(arg1, options2);
}
function $El(obj) {
  const rp = obj;
  if (!rp) {
    return false;
  }
  return typeof rp.base === "string" && typeof rp.pattern === "string";
}
function parsedExpression(expression, options2) {
  const parsedPatterns = aggregateBasenameMatches(Object.getOwnPropertyNames(expression).map((pattern) => parseExpressionPattern(pattern, expression[pattern], options2)).filter((pattern) => pattern !== NULL));
  const patternsLength = parsedPatterns.length;
  if (!patternsLength) {
    return NULL;
  }
  if (!parsedPatterns.some((parsedPattern) => !!parsedPattern.requiresSiblings)) {
    if (patternsLength === 1) {
      return parsedPatterns[0];
    }
    const resultExpression2 = function(path7, basename) {
      let resultPromises = void 0;
      for (let i = 0, n = parsedPatterns.length; i < n; i++) {
        const result = parsedPatterns[i](path7, basename);
        if (typeof result === "string") {
          return result;
        }
        if ($Gh(result)) {
          if (!resultPromises) {
            resultPromises = [];
          }
          resultPromises.push(result);
        }
      }
      if (resultPromises) {
        return (async () => {
          for (const resultPromise of resultPromises) {
            const result = await resultPromise;
            if (typeof result === "string") {
              return result;
            }
          }
          return null;
        })();
      }
      return null;
    };
    const withBasenames2 = parsedPatterns.find((pattern) => !!pattern.allBasenames);
    if (withBasenames2) {
      resultExpression2.allBasenames = withBasenames2.allBasenames;
    }
    const allPaths2 = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []);
    if (allPaths2.length) {
      resultExpression2.allPaths = allPaths2;
    }
    return resultExpression2;
  }
  const resultExpression = function(path7, base, hasSibling) {
    let name = void 0;
    let resultPromises = void 0;
    for (let i = 0, n = parsedPatterns.length; i < n; i++) {
      const parsedPattern = parsedPatterns[i];
      if (parsedPattern.requiresSiblings && hasSibling) {
        if (!base) {
          base = $rc(path7);
        }
        if (!name) {
          name = base.substr(0, base.length - $sc(path7).length);
        }
      }
      const result = parsedPattern(path7, base, name, hasSibling);
      if (typeof result === "string") {
        return result;
      }
      if ($Gh(result)) {
        if (!resultPromises) {
          resultPromises = [];
        }
        resultPromises.push(result);
      }
    }
    if (resultPromises) {
      return (async () => {
        for (const resultPromise of resultPromises) {
          const result = await resultPromise;
          if (typeof result === "string") {
            return result;
          }
        }
        return null;
      })();
    }
    return null;
  };
  const withBasenames = parsedPatterns.find((pattern) => !!pattern.allBasenames);
  if (withBasenames) {
    resultExpression.allBasenames = withBasenames.allBasenames;
  }
  const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []);
  if (allPaths.length) {
    resultExpression.allPaths = allPaths;
  }
  return resultExpression;
}
function parseExpressionPattern(pattern, value, options2) {
  if (value === false) {
    return NULL;
  }
  const parsedPattern = parsePattern(pattern, options2);
  if (parsedPattern === NULL) {
    return NULL;
  }
  if (typeof value === "boolean") {
    return parsedPattern;
  }
  if (value) {
    const when = value.when;
    if (typeof when === "string") {
      const result = (path7, basename, name, hasSibling) => {
        if (!hasSibling || !parsedPattern(path7, basename)) {
          return null;
        }
        const clausePattern = when.replace("$(basename)", () => name);
        const matched = hasSibling(clausePattern);
        return $Gh(matched) ? matched.then((match) => match ? pattern : null) : matched ? pattern : null;
      };
      result.requiresSiblings = true;
      return result;
    }
  }
  return parsedPattern;
}
function aggregateBasenameMatches(parsedPatterns, result) {
  const basenamePatterns = parsedPatterns.filter((parsedPattern) => !!parsedPattern.basenames);
  if (basenamePatterns.length < 2) {
    return parsedPatterns;
  }
  const basenames = basenamePatterns.reduce((all, current) => {
    const basenames2 = current.basenames;
    return basenames2 ? all.concat(basenames2) : all;
  }, []);
  let patterns;
  if (result) {
    patterns = [];
    for (let i = 0, n = basenames.length; i < n; i++) {
      patterns.push(result);
    }
  } else {
    patterns = basenamePatterns.reduce((all, current) => {
      const patterns2 = current.patterns;
      return patterns2 ? all.concat(patterns2) : all;
    }, []);
  }
  const aggregate = function(path7, basename) {
    if (typeof path7 !== "string") {
      return null;
    }
    if (!basename) {
      let i;
      for (i = path7.length; i > 0; i--) {
        const ch = path7.charCodeAt(i - 1);
        if (ch === 47 || ch === 92) {
          break;
        }
      }
      basename = path7.substr(i);
    }
    const index = basenames.indexOf(basename);
    return index !== -1 ? patterns[index] : null;
  };
  aggregate.basenames = basenames;
  aggregate.patterns = patterns;
  aggregate.allBasenames = basenames;
  const aggregatedPatterns = parsedPatterns.filter((parsedPattern) => !parsedPattern.basenames);
  aggregatedPatterns.push(aggregate);
  return aggregatedPatterns;
}
function $Hl(patternsA, patternsB) {
  return $zb(patternsA, patternsB, (a, b) => {
    if (typeof a === "string" && typeof b === "string") {
      return a === b;
    }
    if (typeof a !== "string" && typeof b !== "string") {
      return a.base === b.base && a.pattern === b.pattern;
    }
    return false;
  });
}
var $zl, $Al, PATH_REGEX, NO_PATH_REGEX, ALL_FORWARD_SLASHES, T1, T2, T3, T3_2, T4, T5, CACHE, FALSE, NULL;
var init_glob = __esm({
  "out-build/vs/base/common/glob.js"() {
    "use strict";
    init_arrays();
    init_async();
    init_extpath();
    init_map();
    init_path();
    init_platform();
    init_strings();
    $zl = "**";
    $Al = "/";
    PATH_REGEX = "[/\\\\]";
    NO_PATH_REGEX = "[^/\\\\]";
    ALL_FORWARD_SLASHES = /\//g;
    T1 = /^\*\*\/\*\.[\w\.-]+$/;
    T2 = /^\*\*\/([\w\.-]+)\/?$/;
    T3 = /^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/;
    T3_2 = /^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/;
    T4 = /^\*\*((\/[\w\.-]+)+)\/?$/;
    T5 = /^([\w\.-]+(\/[\w\.-]+)*)\/?$/;
    CACHE = new $Hc(1e4);
    FALSE = function() {
      return false;
    };
    NULL = function() {
      return null;
    };
  }
});

// out-build/vs/platform/files/common/watcher.js
function $7s(request2) {
  return typeof request2.correlationId === "number";
}
function $8s(request2) {
  return request2.recursive === true;
}
function $_s(changes) {
  return changes.map((change) => ({
    type: change.type,
    resource: URI.revive(change.resource),
    cId: change.cId
  }));
}
function $at(changes) {
  const coalescer = new EventCoalescer();
  for (const event of changes) {
    coalescer.processEvent(event);
  }
  return coalescer.coalesce();
}
function $bt(path7, pattern) {
  if (typeof pattern === "string" && !pattern.startsWith($zl) && !$mc(pattern)) {
    return { base: path7, pattern };
  }
  return pattern;
}
function $ct(path7, patterns) {
  const parsedPatterns = [];
  for (const pattern of patterns) {
    parsedPatterns.push($Dl($bt(path7, pattern)));
  }
  return parsedPatterns;
}
function $dt(event, filter) {
  if (typeof filter === "number") {
    switch (event.type) {
      case 1:
        return (filter & 4) === 0;
      case 2:
        return (filter & 8) === 0;
      case 0:
        return (filter & 2) === 0;
    }
  }
  return false;
}
function $et(filter) {
  if (typeof filter === "number") {
    const filters = [];
    if (filter & 4) {
      filters.push("Added");
    }
    if (filter & 8) {
      filters.push("Deleted");
    }
    if (filter & 2) {
      filters.push("Updated");
    }
    if (filters.length === 0) {
      return "<all>";
    }
    return `[${filters.join(", ")}]`;
  }
  return "<none>";
}
var $9s, $0s, $$s, EventCoalescer;
var init_watcher = __esm({
  "out-build/vs/platform/files/common/watcher.js"() {
    "use strict";
    init_glob();
    init_lifecycle();
    init_path();
    init_platform();
    init_uri();
    init_files();
    $9s = class _$9s extends $3c {
      static {
        this.a = 5;
      }
      constructor(h, j, m, n) {
        super();
        this.h = h;
        this.j = j;
        this.m = m;
        this.n = n;
        this.c = this.B(new $4c());
        this.f = void 0;
        this.g = 0;
      }
      s() {
        const disposables = new $2c();
        this.c.value = disposables;
        this.b = this.r(disposables);
        this.b.setVerboseLogging(this.m);
        disposables.add(this.b.onDidChangeFile((changes) => this.h(changes)));
        disposables.add(this.b.onDidLogMessage((msg) => this.j(msg)));
        disposables.add(this.b.onDidError((e) => this.t(e.error, e.request)));
      }
      t(error, failedRequest) {
        if (this.u(error, failedRequest)) {
          if (this.g < _$9s.a && this.f) {
            this.y(`restarting watcher after unexpected error: ${error}`);
            this.w(this.f);
          } else {
            this.y(`gave up attempting to restart watcher after unexpected error: ${error}`);
          }
        } else {
          this.y(error);
        }
      }
      u(error, failedRequest) {
        if (!this.n.restartOnError) {
          return false;
        }
        if (failedRequest) {
          return false;
        }
        if (error.indexOf("No space left on device") !== -1 || error.indexOf("EMFILE") !== -1) {
          return false;
        }
        return true;
      }
      w(requests) {
        this.g++;
        this.s();
        this.watch(requests);
      }
      async watch(requests) {
        this.f = requests;
        await this.b?.watch(requests);
      }
      async setVerboseLogging(verboseLogging) {
        this.m = verboseLogging;
        await this.b?.setVerboseLogging(verboseLogging);
      }
      y(message) {
        this.j({ type: "error", message: `[File Watcher (${this.n.type})] ${message}` });
      }
      z(message) {
        this.j({ type: "trace", message: `[File Watcher (${this.n.type})] ${message}` });
      }
      dispose() {
        this.b = void 0;
        return super.dispose();
      }
    };
    $0s = class extends $9s {
      constructor(onFileChanges, onLogMessage, verboseLogging) {
        super(onFileChanges, onLogMessage, verboseLogging, { type: "node.js", restartOnError: false });
      }
    };
    $$s = class extends $9s {
      constructor(onFileChanges, onLogMessage, verboseLogging) {
        super(onFileChanges, onLogMessage, verboseLogging, { type: "universal", restartOnError: true });
      }
    };
    EventCoalescer = class {
      constructor() {
        this.a = /* @__PURE__ */ new Set();
        this.b = /* @__PURE__ */ new Map();
      }
      c(event) {
        if ($n) {
          return event.resource.fsPath;
        }
        return event.resource.fsPath.toLowerCase();
      }
      processEvent(event) {
        const existingEvent = this.b.get(this.c(event));
        let keepEvent = false;
        if (existingEvent) {
          const currentChangeType = existingEvent.type;
          const newChangeType = event.type;
          if (existingEvent.resource.fsPath !== event.resource.fsPath && (event.type === 2 || event.type === 1)) {
            keepEvent = true;
          } else if (currentChangeType === 1 && newChangeType === 2) {
            this.b.delete(this.c(event));
            this.a.delete(existingEvent);
          } else if (currentChangeType === 2 && newChangeType === 1) {
            existingEvent.type = 0;
          } else if (currentChangeType === 1 && newChangeType === 0) {
          } else {
            existingEvent.type = newChangeType;
          }
        } else {
          keepEvent = true;
        }
        if (keepEvent) {
          this.a.add(event);
          this.b.set(this.c(event), event);
        }
      }
      coalesce() {
        const addOrChangeEvents = [];
        const deletedPaths = [];
        return Array.from(this.a).filter((e) => {
          if (e.type !== 2) {
            addOrChangeEvents.push(e);
            return false;
          }
          return true;
        }).sort((e1, e2) => {
          return e1.resource.fsPath.length - e2.resource.fsPath.length;
        }).filter((e) => {
          if (deletedPaths.some((deletedPath) => $Em(
            e.resource.fsPath,
            deletedPath,
            !$n
            /* ignorecase */
          ))) {
            return false;
          }
          deletedPaths.push(e.resource.fsPath);
          return true;
        }).concat(addOrChangeEvents);
      }
    };
  }
});

// out-build/vs/platform/files/common/diskFileSystemProvider.js
var $fy;
var init_diskFileSystemProvider = __esm({
  "out-build/vs/platform/files/common/diskFileSystemProvider.js"() {
    "use strict";
    init_arrays();
    init_async();
    init_errors();
    init_event();
    init_extpath();
    init_lifecycle();
    init_path();
    init_watcher();
    init_log();
    $fy = class extends $3c {
      constructor(a, b) {
        super();
        this.a = a;
        this.b = b;
        this.c = this.B(new $ze());
        this.onDidChangeFile = this.c.event;
        this.g = this.B(new $ze());
        this.onDidWatchError = this.g.event;
        this.j = [];
        this.m = this.B(new $Th(0));
        this.y = [];
        this.z = this.B(new $Th(0));
      }
      watch(resource, opts) {
        if (opts.recursive || this.b?.watcher?.forceUniversal) {
          return this.n(resource, opts);
        }
        return this.C(resource, opts);
      }
      n(resource, opts) {
        const request2 = this.r(resource, opts);
        const remove = $Wb(this.j, request2);
        this.s();
        return $1c(() => {
          remove();
          this.s();
        });
      }
      r(resource, opts) {
        const request2 = {
          path: this.L(resource),
          excludes: opts.excludes,
          includes: opts.includes,
          recursive: opts.recursive,
          filter: opts.filter,
          correlationId: opts.correlationId
        };
        if ($8s(request2)) {
          const usePolling = this.b?.watcher?.recursive?.usePolling;
          if (usePolling === true) {
            request2.pollingInterval = this.b?.watcher?.recursive?.pollingInterval ?? 5e3;
          } else if (Array.isArray(usePolling)) {
            if (usePolling.includes(request2.path)) {
              request2.pollingInterval = this.b?.watcher?.recursive?.pollingInterval ?? 5e3;
            }
          }
        }
        return request2;
      }
      s() {
        this.m.trigger(() => {
          return this.t();
        }).catch((error) => $gb(error));
      }
      t() {
        if (!this.h) {
          this.h = this.B(this.u((changes) => this.c.fire($_s(changes)), (msg) => this.H(msg), this.a.getLevel() === LogLevel.Trace));
          this.B(this.a.onDidChangeLogLevel(() => {
            this.h?.setVerboseLogging(this.a.getLevel() === LogLevel.Trace);
          }));
        }
        return this.h.watch(this.j);
      }
      C(resource, opts) {
        const request2 = {
          path: this.L(resource),
          excludes: opts.excludes,
          includes: opts.includes,
          recursive: false,
          filter: opts.filter,
          correlationId: opts.correlationId
        };
        const remove = $Wb(this.y, request2);
        this.D();
        return $1c(() => {
          remove();
          this.D();
        });
      }
      D() {
        this.z.trigger(() => {
          return this.F();
        }).catch((error) => $gb(error));
      }
      F() {
        if (!this.w) {
          this.w = this.B(this.G((changes) => this.c.fire($_s(changes)), (msg) => this.H(msg), this.a.getLevel() === LogLevel.Trace));
          this.B(this.a.onDidChangeLogLevel(() => {
            this.w?.setVerboseLogging(this.a.getLevel() === LogLevel.Trace);
          }));
        }
        return this.w.watch(this.y);
      }
      //#endregion
      H(msg) {
        if (msg.type === "error") {
          this.g.fire(msg.message);
        }
        this.I(msg);
      }
      I(msg) {
        this.a[msg.type](msg.message);
      }
      J(resource) {
        return $lc(resource.fsPath);
      }
      L(resource) {
        const filePath = this.J(resource);
        return $3g(filePath);
      }
    };
  }
});

// out-build/vs/base/common/decorators.js
function $0t(_target, key, descriptor) {
  let fnKey = null;
  let fn = null;
  if (typeof descriptor.value === "function") {
    fnKey = "value";
    fn = descriptor.value;
    if (fn.length !== 0) {
      console.warn("Memoize should only be used in functions with zero parameters");
    }
  } else if (typeof descriptor.get === "function") {
    fnKey = "get";
    fn = descriptor.get;
  }
  if (!fn) {
    throw new Error("not supported");
  }
  const memoizeKey = `$memoize$${key}`;
  descriptor[fnKey] = function(...args) {
    if (!this.hasOwnProperty(memoizeKey)) {
      Object.defineProperty(this, memoizeKey, {
        configurable: false,
        enumerable: false,
        writable: false,
        value: fn.apply(this, args)
      });
    }
    return this[memoizeKey];
  };
}
var init_decorators = __esm({
  "out-build/vs/base/common/decorators.js"() {
    "use strict";
  }
});

// out-build/vs/base/parts/ipc/common/ipc.js
function requestTypeToStr(type2) {
  switch (type2) {
    case 100:
      return "req";
    case 101:
      return "cancel";
    case 102:
      return "subscribe";
    case 103:
      return "unsubscribe";
  }
}
function responseTypeToStr(type2) {
  switch (type2) {
    case 200:
      return `init`;
    case 201:
      return `reply:`;
    case 202:
    case 203:
      return `replyErr:`;
    case 204:
      return `event:`;
  }
}
function readIntVQL(reader) {
  let value = 0;
  for (let n = 0; ; n += 7) {
    const next = reader.read(1);
    value |= (next.buffer[0] & 127) << n;
    if (!(next.buffer[0] & 128)) {
      return value;
    }
  }
}
function writeInt32VQL(writer, value) {
  if (value === 0) {
    writer.write(vqlZero);
    return;
  }
  let len = 0;
  for (let v2 = value; v2 !== 0; v2 = v2 >>> 7) {
    len++;
  }
  const scratch = $Ci.alloc(len);
  for (let i = 0; value !== 0; i++) {
    scratch.buffer[i] = value & 127;
    value = value >>> 7;
    if (value > 0) {
      scratch.buffer[i] |= 128;
    }
  }
  writer.write(scratch);
}
function createOneByteBuffer(value) {
  const result = $Ci.alloc(1);
  result.writeUInt8(value, 0);
  return result;
}
function $fu(writer, data) {
  if (typeof data === "undefined") {
    writer.write(BufferPresets.Undefined);
  } else if (typeof data === "string") {
    const buffer = $Ci.fromString(data);
    writer.write(BufferPresets.String);
    writeInt32VQL(writer, buffer.byteLength);
    writer.write(buffer);
  } else if (hasBuffer2 && Buffer.isBuffer(data)) {
    const buffer = $Ci.wrap(data);
    writer.write(BufferPresets.Buffer);
    writeInt32VQL(writer, buffer.byteLength);
    writer.write(buffer);
  } else if (data instanceof $Ci) {
    writer.write(BufferPresets.VSBuffer);
    writeInt32VQL(writer, data.byteLength);
    writer.write(data);
  } else if (Array.isArray(data)) {
    writer.write(BufferPresets.Array);
    writeInt32VQL(writer, data.length);
    for (const el of data) {
      $fu(writer, el);
    }
  } else if (typeof data === "number" && (data | 0) === data) {
    writer.write(BufferPresets.Uint);
    writeInt32VQL(writer, data);
  } else {
    const buffer = $Ci.fromString(JSON.stringify(data));
    writer.write(BufferPresets.Object);
    writeInt32VQL(writer, buffer.byteLength);
    writer.write(buffer);
  }
}
function $gu(reader) {
  const type2 = reader.read(1).readUInt8(0);
  switch (type2) {
    case DataType.Undefined:
      return void 0;
    case DataType.String:
      return reader.read(readIntVQL(reader)).toString();
    case DataType.Buffer:
      return reader.read(readIntVQL(reader)).buffer;
    case DataType.VSBuffer:
      return reader.read(readIntVQL(reader));
    case DataType.Array: {
      const length = readIntVQL(reader);
      const result = [];
      for (let i = 0; i < length; i++) {
        result.push($gu(reader));
      }
      return result;
    }
    case DataType.Object:
      return JSON.parse(reader.read(readIntVQL(reader)).toString());
    case DataType.Int:
      return readIntVQL(reader);
  }
}
function $lu(promise) {
  return {
    call(command, arg, cancellationToken) {
      return promise.then((c) => c.call(command, arg, cancellationToken));
    },
    listen(event, arg) {
      const relay = new $Ie();
      promise.then((c) => relay.input = c.listen(event, arg));
      return relay.event;
    }
  };
}
function $mu(channel) {
  let didTick = false;
  return {
    call(command, arg, cancellationToken) {
      if (didTick) {
        return channel.call(command, arg, cancellationToken);
      }
      return $Wh(0).then(() => didTick = true).then(() => channel.call(command, arg, cancellationToken));
    },
    listen(event, arg) {
      if (didTick) {
        return channel.listen(event, arg);
      }
      const relay = new $Ie();
      $Wh(0).then(() => didTick = true).then(() => relay.input = channel.listen(event, arg));
      return relay.event;
    }
  };
}
var RequestType, ResponseType, State, vqlZero, $du, $eu, DataType, BufferPresets, hasBuffer2, $hu, RequestInitiator, $iu, $ju, $nu, ProxyChannel;
var init_ipc = __esm({
  "out-build/vs/base/parts/ipc/common/ipc.js"() {
    "use strict";
    init_arrays();
    init_async();
    init_buffer();
    init_cancellation();
    init_decorators();
    init_errors();
    init_event();
    init_functional();
    init_lifecycle();
    init_marshalling();
    init_strings();
    init_types();
    (function(RequestType2) {
      RequestType2[RequestType2["Promise"] = 100] = "Promise";
      RequestType2[RequestType2["PromiseCancel"] = 101] = "PromiseCancel";
      RequestType2[RequestType2["EventListen"] = 102] = "EventListen";
      RequestType2[RequestType2["EventDispose"] = 103] = "EventDispose";
    })(RequestType || (RequestType = {}));
    (function(ResponseType2) {
      ResponseType2[ResponseType2["Initialize"] = 200] = "Initialize";
      ResponseType2[ResponseType2["PromiseSuccess"] = 201] = "PromiseSuccess";
      ResponseType2[ResponseType2["PromiseError"] = 202] = "PromiseError";
      ResponseType2[ResponseType2["PromiseErrorObj"] = 203] = "PromiseErrorObj";
      ResponseType2[ResponseType2["EventFire"] = 204] = "EventFire";
    })(ResponseType || (ResponseType = {}));
    (function(State2) {
      State2[State2["Uninitialized"] = 0] = "Uninitialized";
      State2[State2["Idle"] = 1] = "Idle";
    })(State || (State = {}));
    vqlZero = createOneByteBuffer(0);
    $du = class {
      constructor(b) {
        this.b = b;
        this.a = 0;
      }
      read(bytes) {
        const result = this.b.slice(this.a, this.a + bytes);
        this.a += result.byteLength;
        return result;
      }
    };
    $eu = class {
      constructor() {
        this.a = [];
      }
      get buffer() {
        return $Ci.concat(this.a);
      }
      write(buffer) {
        this.a.push(buffer);
      }
    };
    (function(DataType2) {
      DataType2[DataType2["Undefined"] = 0] = "Undefined";
      DataType2[DataType2["String"] = 1] = "String";
      DataType2[DataType2["Buffer"] = 2] = "Buffer";
      DataType2[DataType2["VSBuffer"] = 3] = "VSBuffer";
      DataType2[DataType2["Array"] = 4] = "Array";
      DataType2[DataType2["Object"] = 5] = "Object";
      DataType2[DataType2["Int"] = 6] = "Int";
    })(DataType || (DataType = {}));
    BufferPresets = {
      Undefined: createOneByteBuffer(DataType.Undefined),
      String: createOneByteBuffer(DataType.String),
      Buffer: createOneByteBuffer(DataType.Buffer),
      VSBuffer: createOneByteBuffer(DataType.VSBuffer),
      Array: createOneByteBuffer(DataType.Array),
      Object: createOneByteBuffer(DataType.Object),
      Uint: createOneByteBuffer(DataType.Int)
    };
    hasBuffer2 = typeof Buffer !== "undefined";
    $hu = class {
      constructor(h, j, k = null, l = 1e3) {
        this.h = h;
        this.j = j;
        this.k = k;
        this.l = l;
        this.b = /* @__PURE__ */ new Map();
        this.d = /* @__PURE__ */ new Map();
        this.g = /* @__PURE__ */ new Map();
        this.f = this.h.onMessage((msg) => this.q(msg));
        this.m({
          type: 200
          /* ResponseType.Initialize */
        });
      }
      registerChannel(channelName, channel) {
        this.b.set(channelName, channel);
        setTimeout(() => this.w(channelName), 0);
      }
      m(response) {
        switch (response.type) {
          case 200: {
            const msgLength = this.o([response.type]);
            this.k?.logOutgoing(msgLength, 0, 1, responseTypeToStr(response.type));
            return;
          }
          case 201:
          case 202:
          case 204:
          case 203: {
            const msgLength = this.o([response.type, response.id], response.data);
            this.k?.logOutgoing(msgLength, response.id, 1, responseTypeToStr(response.type), response.data);
            return;
          }
        }
      }
      o(header, body = void 0) {
        const writer = new $eu();
        $fu(writer, header);
        $fu(writer, body);
        return this.p(writer.buffer);
      }
      p(message) {
        try {
          this.h.send(message);
          return message.byteLength;
        } catch (err) {
          return 0;
        }
      }
      q(message) {
        const reader = new $du(message);
        const header = $gu(reader);
        const body = $gu(reader);
        const type2 = header[0];
        switch (type2) {
          case 100:
            this.k?.logIncoming(message.byteLength, header[1], 1, `${requestTypeToStr(type2)}: ${header[2]}.${header[3]}`, body);
            return this.s({ type: type2, id: header[1], channelName: header[2], name: header[3], arg: body });
          case 102:
            this.k?.logIncoming(message.byteLength, header[1], 1, `${requestTypeToStr(type2)}: ${header[2]}.${header[3]}`, body);
            return this.t({ type: type2, id: header[1], channelName: header[2], name: header[3], arg: body });
          case 101:
            this.k?.logIncoming(message.byteLength, header[1], 1, `${requestTypeToStr(type2)}`);
            return this.u({ type: type2, id: header[1] });
          case 103:
            this.k?.logIncoming(message.byteLength, header[1], 1, `${requestTypeToStr(type2)}`);
            return this.u({ type: type2, id: header[1] });
        }
      }
      s(request2) {
        const channel = this.b.get(request2.channelName);
        if (!channel) {
          this.v(request2);
          return;
        }
        const cancellationTokenSource = new $ad();
        let promise;
        try {
          promise = channel.call(this.j, request2.name, request2.arg, cancellationTokenSource.token);
        } catch (err) {
          promise = Promise.reject(err);
        }
        const id2 = request2.id;
        promise.then((data) => {
          this.m({
            id: id2,
            data,
            type: 201
            /* ResponseType.PromiseSuccess */
          });
        }, (err) => {
          if (err instanceof Error) {
            this.m({
              id: id2,
              data: {
                message: err.message,
                name: err.name,
                stack: err.stack ? err.stack.split("\n") : void 0
              },
              type: 202
              /* ResponseType.PromiseError */
            });
          } else {
            this.m({
              id: id2,
              data: err,
              type: 203
              /* ResponseType.PromiseErrorObj */
            });
          }
        }).finally(() => {
          disposable.dispose();
          this.d.delete(request2.id);
        });
        const disposable = $1c(() => cancellationTokenSource.cancel());
        this.d.set(request2.id, disposable);
      }
      t(request2) {
        const channel = this.b.get(request2.channelName);
        if (!channel) {
          this.v(request2);
          return;
        }
        const id2 = request2.id;
        const event = channel.listen(this.j, request2.name, request2.arg);
        const disposable = event((data) => this.m({
          id: id2,
          data,
          type: 204
          /* ResponseType.EventFire */
        }));
        this.d.set(request2.id, disposable);
      }
      u(request2) {
        const disposable = this.d.get(request2.id);
        if (disposable) {
          disposable.dispose();
          this.d.delete(request2.id);
        }
      }
      v(request2) {
        let pendingRequests = this.g.get(request2.channelName);
        if (!pendingRequests) {
          pendingRequests = [];
          this.g.set(request2.channelName, pendingRequests);
        }
        const timer = setTimeout(() => {
          console.error(`Unknown channel: ${request2.channelName}`);
          if (request2.type === 100) {
            this.m({
              id: request2.id,
              data: { name: "Unknown channel", message: `Channel name '${request2.channelName}' timed out after ${this.l}ms`, stack: void 0 },
              type: 202
              /* ResponseType.PromiseError */
            });
          }
        }, this.l);
        pendingRequests.push({ request: request2, timeoutTimer: timer });
      }
      w(channelName) {
        const requests = this.g.get(channelName);
        if (requests) {
          for (const request2 of requests) {
            clearTimeout(request2.timeoutTimer);
            switch (request2.request.type) {
              case 100:
                this.s(request2.request);
                break;
              case 102:
                this.t(request2.request);
                break;
            }
          }
          this.g.delete(channelName);
        }
      }
      dispose() {
        if (this.f) {
          this.f.dispose();
          this.f = null;
        }
        $Xc(this.d.values());
        this.d.clear();
      }
    };
    (function(RequestInitiator2) {
      RequestInitiator2[RequestInitiator2["LocalSide"] = 0] = "LocalSide";
      RequestInitiator2[RequestInitiator2["OtherSide"] = 1] = "OtherSide";
    })(RequestInitiator || (RequestInitiator = {}));
    $iu = class {
      constructor(l, logger = null) {
        this.l = l;
        this.a = false;
        this.b = State.Uninitialized;
        this.d = /* @__PURE__ */ new Set();
        this.f = /* @__PURE__ */ new Map();
        this.g = 0;
        this.k = new $ze();
        this.onDidInitialize = this.k.event;
        this.h = this.l.onMessage((msg) => this.s(msg));
        this.j = logger;
      }
      getChannel(channelName) {
        const that = this;
        return {
          call(command, arg, cancellationToken) {
            if (that.a) {
              return Promise.reject(new $lb());
            }
            return that.m(channelName, command, arg, cancellationToken);
          },
          listen(event, arg) {
            if (that.a) {
              return Event.None;
            }
            return that.o(channelName, event, arg);
          }
        };
      }
      m(channelName, name, arg, cancellationToken = CancellationToken.None) {
        const id2 = this.g++;
        const type2 = 100;
        const request2 = { id: id2, type: type2, channelName, name, arg };
        if (cancellationToken.isCancellationRequested) {
          return Promise.reject(new $lb());
        }
        let disposable;
        let disposableWithRequestCancel;
        const result = new Promise((c, e) => {
          if (cancellationToken.isCancellationRequested) {
            return e(new $lb());
          }
          const doRequest = () => {
            const handler = (response) => {
              switch (response.type) {
                case 201:
                  this.f.delete(id2);
                  c(response.data);
                  break;
                case 202: {
                  this.f.delete(id2);
                  const error = new Error(response.data.message);
                  error.stack = Array.isArray(response.data.stack) ? response.data.stack.join("\n") : response.data.stack;
                  error.name = response.data.name;
                  e(error);
                  break;
                }
                case 203:
                  this.f.delete(id2);
                  e(response.data);
                  break;
              }
            };
            this.f.set(id2, handler);
            this.p(request2);
          };
          let uninitializedPromise = null;
          if (this.b === State.Idle) {
            doRequest();
          } else {
            uninitializedPromise = $Hh((_) => this.u());
            uninitializedPromise.then(() => {
              uninitializedPromise = null;
              doRequest();
            });
          }
          const cancel = () => {
            if (uninitializedPromise) {
              uninitializedPromise.cancel();
              uninitializedPromise = null;
            } else {
              this.p({
                id: id2,
                type: 101
                /* RequestType.PromiseCancel */
              });
            }
            e(new $lb());
          };
          disposable = cancellationToken.onCancellationRequested(cancel);
          disposableWithRequestCancel = {
            dispose: $Qc(() => {
              cancel();
              disposable.dispose();
            })
          };
          this.d.add(disposableWithRequestCancel);
        });
        return result.finally(() => {
          disposable.dispose();
          this.d.delete(disposableWithRequestCancel);
        });
      }
      o(channelName, name, arg) {
        const id2 = this.g++;
        const type2 = 102;
        const request2 = { id: id2, type: type2, channelName, name, arg };
        let uninitializedPromise = null;
        const emitter = new $ze({
          onWillAddFirstListener: () => {
            const doRequest = () => {
              this.d.add(emitter);
              this.p(request2);
            };
            if (this.b === State.Idle) {
              doRequest();
            } else {
              uninitializedPromise = $Hh((_) => this.u());
              uninitializedPromise.then(() => {
                uninitializedPromise = null;
                doRequest();
              });
            }
          },
          onDidRemoveLastListener: () => {
            if (uninitializedPromise) {
              uninitializedPromise.cancel();
              uninitializedPromise = null;
            } else {
              this.d.delete(emitter);
              this.p({
                id: id2,
                type: 103
                /* RequestType.EventDispose */
              });
            }
          }
        });
        const handler = (res) => emitter.fire(res.data);
        this.f.set(id2, handler);
        return emitter.event;
      }
      p(request2) {
        switch (request2.type) {
          case 100:
          case 102: {
            const msgLength = this.q([request2.type, request2.id, request2.channelName, request2.name], request2.arg);
            this.j?.logOutgoing(msgLength, request2.id, 0, `${requestTypeToStr(request2.type)}: ${request2.channelName}.${request2.name}`, request2.arg);
            return;
          }
          case 101:
          case 103: {
            const msgLength = this.q([request2.type, request2.id]);
            this.j?.logOutgoing(msgLength, request2.id, 0, requestTypeToStr(request2.type));
            return;
          }
        }
      }
      q(header, body = void 0) {
        const writer = new $eu();
        $fu(writer, header);
        $fu(writer, body);
        return this.r(writer.buffer);
      }
      r(message) {
        try {
          this.l.send(message);
          return message.byteLength;
        } catch (err) {
          return 0;
        }
      }
      s(message) {
        const reader = new $du(message);
        const header = $gu(reader);
        const body = $gu(reader);
        const type2 = header[0];
        switch (type2) {
          case 200:
            this.j?.logIncoming(message.byteLength, 0, 0, responseTypeToStr(type2));
            return this.t({ type: header[0] });
          case 201:
          case 202:
          case 204:
          case 203:
            this.j?.logIncoming(message.byteLength, header[1], 0, responseTypeToStr(type2), body);
            return this.t({ type: header[0], id: header[1], data: body });
        }
      }
      t(response) {
        if (response.type === 200) {
          this.b = State.Idle;
          this.k.fire();
          return;
        }
        const handler = this.f.get(response.id);
        handler?.(response);
      }
      get onDidInitializePromise() {
        return Event.toPromise(this.onDidInitialize);
      }
      u() {
        if (this.b === State.Idle) {
          return Promise.resolve();
        } else {
          return this.onDidInitializePromise;
        }
      }
      dispose() {
        this.a = true;
        if (this.h) {
          this.h.dispose();
          this.h = null;
        }
        $Xc(this.d.values());
        this.d.clear();
      }
    };
    __decorate([
      $0t
    ], $iu.prototype, "onDidInitializePromise", null);
    $ju = class {
      get connections() {
        const result = [];
        this.f.forEach((ctx) => result.push(ctx));
        return result;
      }
      constructor(onDidClientConnect, ipcLogger, timeoutDelay) {
        this.a = /* @__PURE__ */ new Map();
        this.f = /* @__PURE__ */ new Set();
        this.g = new $ze();
        this.onDidAddConnection = this.g.event;
        this.h = new $ze();
        this.onDidRemoveConnection = this.h.event;
        this.j = new $2c();
        this.j.add(onDidClientConnect(({ protocol, onDidClientDisconnect }) => {
          const onFirstMessage = Event.once(protocol.onMessage);
          this.j.add(onFirstMessage((msg) => {
            const reader = new $du(msg);
            const ctx = $gu(reader);
            const channelServer = new $hu(protocol, ctx, ipcLogger, timeoutDelay);
            const channelClient = new $iu(protocol, ipcLogger);
            this.a.forEach((channel, name) => channelServer.registerChannel(name, channel));
            const connection = { channelServer, channelClient, ctx };
            this.f.add(connection);
            this.g.fire(connection);
            this.j.add(onDidClientDisconnect(() => {
              channelServer.dispose();
              channelClient.dispose();
              this.f.delete(connection);
              this.h.fire(connection);
            }));
          }));
        }));
      }
      getChannel(channelName, routerOrClientFilter) {
        const that = this;
        return {
          call(command, arg, cancellationToken) {
            let connectionPromise;
            if ($Ng(routerOrClientFilter)) {
              const connection = $6b(that.connections.filter(routerOrClientFilter));
              connectionPromise = connection ? Promise.resolve(connection) : Event.toPromise(Event.filter(that.onDidAddConnection, routerOrClientFilter));
            } else {
              connectionPromise = routerOrClientFilter.routeCall(that, command, arg);
            }
            const channelPromise = connectionPromise.then((connection) => connection.channelClient.getChannel(channelName));
            return $lu(channelPromise).call(command, arg, cancellationToken);
          },
          listen(event, arg) {
            if ($Ng(routerOrClientFilter)) {
              return that.k(channelName, routerOrClientFilter, event, arg);
            }
            const channelPromise = routerOrClientFilter.routeEvent(that, event, arg).then((connection) => connection.channelClient.getChannel(channelName));
            return $lu(channelPromise).listen(event, arg);
          }
        };
      }
      k(channelName, clientFilter, eventName, arg) {
        const that = this;
        let disposables;
        const emitter = new $ze({
          onWillAddFirstListener: () => {
            disposables = new $2c();
            const eventMultiplexer = new $Fe();
            const map = /* @__PURE__ */ new Map();
            const onDidAddConnection = (connection) => {
              const channel = connection.channelClient.getChannel(channelName);
              const event = channel.listen(eventName, arg);
              const disposable = eventMultiplexer.add(event);
              map.set(connection, disposable);
            };
            const onDidRemoveConnection = (connection) => {
              const disposable = map.get(connection);
              if (!disposable) {
                return;
              }
              disposable.dispose();
              map.delete(connection);
            };
            that.connections.filter(clientFilter).forEach(onDidAddConnection);
            Event.filter(that.onDidAddConnection, clientFilter)(onDidAddConnection, void 0, disposables);
            that.onDidRemoveConnection(onDidRemoveConnection, void 0, disposables);
            eventMultiplexer.event(emitter.fire, emitter, disposables);
            disposables.add(eventMultiplexer);
          },
          onDidRemoveLastListener: () => {
            disposables?.dispose();
            disposables = void 0;
          }
        });
        that.j.add(emitter);
        return emitter.event;
      }
      registerChannel(channelName, channel) {
        this.a.set(channelName, channel);
        for (const connection of this.f) {
          connection.channelServer.registerChannel(channelName, channel);
        }
      }
      dispose() {
        this.j.dispose();
        for (const connection of this.f) {
          connection.channelClient.dispose();
          connection.channelServer.dispose();
        }
        this.f.clear();
        this.a.clear();
        this.g.dispose();
        this.h.dispose();
      }
    };
    $nu = class {
      constructor(a) {
        this.a = a;
      }
      routeCall(hub) {
        return this.b(hub);
      }
      routeEvent(hub) {
        return this.b(hub);
      }
      async b(hub) {
        for (const connection of hub.connections) {
          if (await Promise.resolve(this.a(connection.ctx))) {
            return Promise.resolve(connection);
          }
        }
        await Event.toPromise(hub.onDidAddConnection);
        return await this.b(hub);
      }
    };
    (function(ProxyChannel2) {
      function fromService(service, disposables, options2) {
        const handler = service;
        const disableMarshalling = options2 && options2.disableMarshalling;
        const mapEventNameToEvent = /* @__PURE__ */ new Map();
        for (const key in handler) {
          if (propertyIsEvent(key)) {
            mapEventNameToEvent.set(key, Event.buffer(handler[key], true, void 0, disposables));
          }
        }
        return new class {
          listen(_, event, arg) {
            const eventImpl = mapEventNameToEvent.get(event);
            if (eventImpl) {
              return eventImpl;
            }
            const target = handler[event];
            if (typeof target === "function") {
              if (propertyIsDynamicEvent(event)) {
                return target.call(handler, arg);
              }
              if (propertyIsEvent(event)) {
                mapEventNameToEvent.set(event, Event.buffer(handler[event], true, void 0, disposables));
                return mapEventNameToEvent.get(event);
              }
            }
            throw new $ub(`Event not found: ${event}`);
          }
          call(_, command, args) {
            const target = handler[command];
            if (typeof target === "function") {
              if (!disableMarshalling && Array.isArray(args)) {
                for (let i = 0; i < args.length; i++) {
                  args[i] = $cu(args[i]);
                }
              }
              let res = target.apply(handler, args);
              if (!(res instanceof Promise)) {
                res = Promise.resolve(res);
              }
              return res;
            }
            throw new $ub(`Method not found: ${command}`);
          }
        }();
      }
      ProxyChannel2.fromService = fromService;
      function toService(channel, options2) {
        const disableMarshalling = options2 && options2.disableMarshalling;
        return new Proxy({}, {
          get(_target, propKey) {
            if (typeof propKey === "string") {
              if (options2?.properties?.has(propKey)) {
                return options2.properties.get(propKey);
              }
              if (propertyIsDynamicEvent(propKey)) {
                return function(arg) {
                  return channel.listen(propKey, arg);
                };
              }
              if (propertyIsEvent(propKey)) {
                return channel.listen(propKey);
              }
              return async function(...args) {
                let methodArgs;
                if (options2 && !$Ig(options2.context)) {
                  methodArgs = [options2.context, ...args];
                } else {
                  methodArgs = args;
                }
                const result = await channel.call(propKey, methodArgs);
                if (!disableMarshalling) {
                  return $cu(result);
                }
                return result;
              };
            }
            throw new $ub(`Property not found: ${String(propKey)}`);
          }
        });
      }
      ProxyChannel2.toService = toService;
      function propertyIsEvent(name) {
        return name[0] === "o" && name[1] === "n" && $Zf(name.charCodeAt(2));
      }
      function propertyIsDynamicEvent(name) {
        return /^onDynamic/.test(name) && $Zf(name.charCodeAt(9));
      }
    })(ProxyChannel || (ProxyChannel = {}));
  }
});

// out-build/vs/base/common/console.js
function $gy(obj) {
  const entry = obj;
  return entry && typeof entry.type === "string" && typeof entry.severity === "string";
}
function $hy(entry) {
  const args = [];
  let stack;
  try {
    const parsedArguments = JSON.parse(entry.arguments);
    const stackArgument = parsedArguments[parsedArguments.length - 1];
    if (stackArgument && stackArgument.__$stack) {
      parsedArguments.pop();
      stack = stackArgument.__$stack;
    }
    args.push(...parsedArguments);
  } catch (error) {
    args.push("Unable to log remote console arguments", entry.arguments);
  }
  return { args, stack };
}
function findFirstFrame(stack) {
  if (!stack) {
    return stack;
  }
  const newlineIndex = stack.indexOf("\n");
  if (newlineIndex === -1) {
    return stack;
  }
  return stack.substring(0, newlineIndex);
}
function log2(entry, label) {
  const { args, stack } = $hy(entry);
  const isOneStringArg = typeof args[0] === "string" && args.length === 1;
  let topFrame = findFirstFrame(stack);
  if (topFrame) {
    topFrame = `(${topFrame.trim()})`;
  }
  let consoleArgs = [];
  if (typeof args[0] === "string") {
    if (topFrame && isOneStringArg) {
      consoleArgs = [`%c[${label}] %c${args[0]} %c${topFrame}`, color("blue"), color(""), color("grey")];
    } else {
      consoleArgs = [`%c[${label}] %c${args[0]}`, color("blue"), color(""), ...args.slice(1)];
    }
  } else {
    consoleArgs = [`%c[${label}]%`, color("blue"), ...args];
  }
  if (topFrame && !isOneStringArg) {
    consoleArgs.push(topFrame);
  }
  if (typeof console[entry.severity] !== "function") {
    throw new Error("Unknown console method");
  }
  console[entry.severity].apply(console, consoleArgs);
}
function color(color2) {
  return `color: ${color2}`;
}
var init_console = __esm({
  "out-build/vs/base/common/console.js"() {
    "use strict";
    init_uri();
  }
});

// out-build/vs/base/parts/ipc/node/ipc.cp.js
import { fork as fork2 } from "child_process";
var $ly;
var init_ipc_cp = __esm({
  "out-build/vs/base/parts/ipc/node/ipc.cp.js"() {
    "use strict";
    init_async();
    init_buffer();
    init_cancellation();
    init_console();
    init_errors();
    init_event();
    init_lifecycle();
    init_objects();
    init_processes2();
    init_processes();
    init_ipc();
    $ly = class {
      constructor(i, j) {
        this.i = i;
        this.j = j;
        this.c = /* @__PURE__ */ new Set();
        this.g = /* @__PURE__ */ new Map();
        this.h = new $ze();
        this.onDidProcessExit = this.h.event;
        const timeout = j && j.timeout ? j.timeout : 6e4;
        this.b = new $Sh(timeout);
        this.d = null;
        this.f = null;
      }
      getChannel(channelName) {
        const that = this;
        return {
          call(command, arg, cancellationToken) {
            return that.k(channelName, command, arg, cancellationToken);
          },
          listen(event, arg) {
            return that.l(channelName, event, arg);
          }
        };
      }
      k(channelName, name, arg, cancellationToken = CancellationToken.None) {
        if (!this.b) {
          return Promise.reject(new Error("disposed"));
        }
        if (cancellationToken.isCancellationRequested) {
          return Promise.reject($mb());
        }
        this.b.cancel();
        const channel = this.n(channelName);
        const result = $Hh((token) => channel.call(name, arg, token));
        const cancellationTokenListener = cancellationToken.onCancellationRequested(() => result.cancel());
        const disposable = $1c(() => result.cancel());
        this.c.add(disposable);
        result.finally(() => {
          cancellationTokenListener.dispose();
          this.c.delete(disposable);
          if (this.c.size === 0 && this.b) {
            this.b.trigger(() => this.o());
          }
        });
        return result;
      }
      l(channelName, name, arg) {
        if (!this.b) {
          return Event.None;
        }
        this.b.cancel();
        let listener;
        const emitter = new $ze({
          onWillAddFirstListener: () => {
            const channel = this.n(channelName);
            const event = channel.listen(name, arg);
            listener = event(emitter.fire, emitter);
            this.c.add(listener);
          },
          onDidRemoveLastListener: () => {
            this.c.delete(listener);
            listener.dispose();
            if (this.c.size === 0 && this.b) {
              this.b.trigger(() => this.o());
            }
          }
        });
        return emitter.event;
      }
      get m() {
        if (!this.f) {
          const args = this.j && this.j.args ? this.j.args : [];
          const forkOpts = /* @__PURE__ */ Object.create(null);
          forkOpts.env = { ...$Lv(process.env), "VSCODE_PARENT_PID": String(process.pid) };
          if (this.j && this.j.env) {
            forkOpts.env = { ...forkOpts.env, ...this.j.env };
          }
          if (this.j && this.j.freshExecArgv) {
            forkOpts.execArgv = [];
          }
          if (this.j && typeof this.j.debug === "number") {
            forkOpts.execArgv = ["--nolazy", "--inspect=" + this.j.debug];
          }
          if (this.j && typeof this.j.debugBrk === "number") {
            forkOpts.execArgv = ["--nolazy", "--inspect-brk=" + this.j.debugBrk];
          }
          if (forkOpts.execArgv === void 0) {
            forkOpts.execArgv = process.execArgv.filter((a) => !/^--inspect(-brk)?=/.test(a)).filter((a) => !a.startsWith("--vscode-"));
          }
          $Fx(forkOpts.env);
          this.d = fork2(this.i, args, forkOpts);
          const onMessageEmitter = new $ze();
          const onRawMessage = Event.fromNodeEventEmitter(this.d, "message", (msg) => msg);
          const rawMessageDisposable = onRawMessage((msg) => {
            if ($gy(msg)) {
              log2(msg, `IPC Library: ${this.j.serverName}`);
              return;
            }
            onMessageEmitter.fire($Ci.wrap(Buffer.from(msg, "base64")));
          });
          const sender = this.j.useQueue ? $Tx(this.d) : this.d;
          const send = (r) => this.d && this.d.connected && sender.send(r.buffer.toString("base64"));
          const onMessage = onMessageEmitter.event;
          const protocol = { send, onMessage };
          this.f = new $iu(protocol);
          const onExit = () => this.o();
          process.once("exit", onExit);
          this.d.on("error", (err) => console.warn('IPC "' + this.j.serverName + '" errored with ' + err));
          this.d.on("exit", (code, signal) => {
            process.removeListener("exit", onExit);
            rawMessageDisposable.dispose();
            this.c.forEach((r) => $Xc(r));
            this.c.clear();
            if (code !== 0 && signal !== "SIGTERM") {
              console.warn('IPC "' + this.j.serverName + '" crashed with exit code ' + code + " and signal " + signal);
            }
            this.b?.cancel();
            this.o();
            this.h.fire({ code, signal });
          });
        }
        return this.f;
      }
      n(name) {
        let channel = this.g.get(name);
        if (!channel) {
          channel = this.m.getChannel(name);
          this.g.set(name, channel);
        }
        return channel;
      }
      o() {
        if (this.f) {
          if (this.d) {
            this.d.kill();
            this.d = null;
          }
          this.f = null;
          this.g.clear();
        }
      }
      dispose() {
        this.h.dispose();
        this.b?.cancel();
        this.b = void 0;
        this.o();
        this.c.clear();
      }
    };
  }
});

// out-build/vs/platform/files/node/watcher/watcherClient.js
var $my;
var init_watcherClient = __esm({
  "out-build/vs/platform/files/node/watcher/watcherClient.js"() {
    "use strict";
    init_network();
    init_ipc();
    init_ipc_cp();
    init_watcher();
    $my = class extends $$s {
      constructor(onFileChanges, onLogMessage, verboseLogging) {
        super(onFileChanges, onLogMessage, verboseLogging);
        this.s();
      }
      r(disposables) {
        const client = disposables.add(new $ly($ih.asFileUri("bootstrap-fork").fsPath, {
          serverName: "File Watcher",
          args: ["--type=fileWatcher"],
          env: {
            VSCODE_ESM_ENTRYPOINT: "vs/platform/files/node/watcher/watcherMain",
            VSCODE_PIPE_LOGGING: "true",
            VSCODE_VERBOSE_LOGGING: "true"
            // transmit console logs from server to client
          }
        }));
        disposables.add(client.onDidProcessExit(({ code, signal }) => this.t(`terminated by itself with code ${code}, signal: ${signal} (ETERM)`)));
        return ProxyChannel.toService($mu(client.getChannel("watcher")));
      }
    };
  }
});

// out-build/vs/platform/files/node/watcher/baseWatcher.js
import { watchFile, unwatchFile } from "fs";
var $ny;
var init_baseWatcher = __esm({
  "out-build/vs/platform/files/node/watcher/baseWatcher.js"() {
    "use strict";
    init_lifecycle();
    init_watcher();
    init_event();
    init_uri();
    init_async();
    init_hash();
    init_errors();
    $ny = class extends $3c {
      constructor() {
        super();
        this.a = this.B(new $ze());
        this.onDidChangeFile = this.a.event;
        this.b = this.B(new $ze());
        this.onDidLogMessage = this.b.event;
        this.c = this.B(new $ze());
        this.f = this.c.event;
        this.g = /* @__PURE__ */ new Map();
        this.h = /* @__PURE__ */ new Map();
        this.j = this.B(new $_c());
        this.m = /* @__PURE__ */ new Set();
        this.n = this.B(new $Th(this.y()));
        this.r = 5007;
        this.s = new $gi();
        this.R = false;
        this.B(this.f((request2) => this.z({
          id: this.u(request2),
          correlationId: this.t(request2) ? request2.correlationId : void 0,
          path: request2.path
        })));
      }
      t(request2) {
        return $7s(request2);
      }
      u(request2) {
        if (this.t(request2)) {
          return request2.correlationId;
        } else {
          return $Xi(request2);
        }
      }
      async watch(requests) {
        if (!this.s.isSettled) {
          this.s.complete();
        }
        this.s = new $gi();
        try {
          this.g.clear();
          this.h.clear();
          for (const request2 of requests) {
            if (this.t(request2)) {
              this.g.set(request2.correlationId, request2);
            } else {
              this.h.set(this.u(request2), request2);
            }
          }
          for (const [id2] of this.j) {
            if (!this.h.has(id2) && !this.g.has(id2)) {
              this.j.deleteAndDispose(id2);
              this.m.delete(id2);
            }
          }
          return await this.w(
            false
            /* not delayed */
          );
        } finally {
          this.s.complete();
        }
      }
      w(delayed) {
        const nonSuspendedRequests = [];
        for (const [id2, request2] of [...this.h, ...this.g]) {
          if (!this.j.has(id2)) {
            nonSuspendedRequests.push(request2);
          }
        }
        return this.n.trigger(() => this.N(nonSuspendedRequests), delayed ? this.y() : 0).catch((error) => $gb(error));
      }
      y() {
        return 800;
      }
      isSuspended(request2) {
        const id2 = this.u(request2);
        return this.m.has(id2) ? "polling" : this.j.has(id2);
      }
      async z(request2) {
        if (this.j.has(request2.id)) {
          return;
        }
        const disposables = new $2c();
        this.j.set(request2.id, disposables);
        await this.s.p;
        if (disposables.isDisposed) {
          return;
        }
        this.D(request2, disposables);
        this.w(
          true
          /* delay this call as we might accumulate many failing watch requests on startup */
        );
      }
      C(request2) {
        this.j.deleteAndDispose(request2.id);
        this.m.delete(request2.id);
        this.w(false);
      }
      D(request2, disposables) {
        if (this.F(request2, disposables)) {
          this.P(`reusing an existing recursive watcher to monitor ${request2.path}`);
          this.m.delete(request2.id);
        } else {
          this.G(request2, disposables);
          this.m.add(request2.id);
        }
      }
      F(request2, disposables) {
        const subscription = this.O?.subscribe(request2.path, (error, change) => {
          if (disposables.isDisposed) {
            return;
          }
          if (error) {
            this.D(request2, disposables);
          } else if (change?.type === 1) {
            this.H(request2);
          }
        });
        if (subscription) {
          disposables.add(subscription);
          return true;
        }
        return false;
      }
      G(request2, disposables) {
        let pathNotFound = false;
        const watchFileCallback = (curr, prev) => {
          if (disposables.isDisposed) {
            return;
          }
          const currentPathNotFound = this.I(curr);
          const previousPathNotFound = this.I(prev);
          const oldPathNotFound = pathNotFound;
          pathNotFound = currentPathNotFound;
          if (!currentPathNotFound && (previousPathNotFound || oldPathNotFound)) {
            this.H(request2);
          }
        };
        this.P(`starting fs.watchFile() on ${request2.path} (correlationId: ${request2.correlationId})`);
        try {
          watchFile(request2.path, { persistent: false, interval: this.r }, watchFileCallback);
        } catch (error) {
          this.Q(`fs.watchFile() failed with error ${error} on path ${request2.path} (correlationId: ${request2.correlationId})`);
        }
        disposables.add($1c(() => {
          this.P(`stopping fs.watchFile() on ${request2.path} (correlationId: ${request2.correlationId})`);
          try {
            unwatchFile(request2.path, watchFileCallback);
          } catch (error) {
            this.Q(`fs.unwatchFile() failed with error ${error} on path ${request2.path} (correlationId: ${request2.correlationId})`);
          }
        }));
      }
      H(request2) {
        this.P(`detected ${request2.path} exists again, resuming watcher (correlationId: ${request2.correlationId})`);
        const event = { resource: URI.file(request2.path), type: 1, cId: request2.correlationId };
        this.a.fire([event]);
        this.J(event, request2);
        this.C(request2);
      }
      I(stats) {
        return stats.ctimeMs === 0 && stats.ino === 0;
      }
      async stop() {
        this.j.clearAndDisposeAll();
        this.m.clear();
      }
      J(event, request2) {
        if (this.R) {
          const traceMsg = ` >> normalized ${event.type === 1 ? "[ADDED]" : event.type === 2 ? "[DELETED]" : "[CHANGED]"} ${event.resource.fsPath}`;
          this.L(traceMsg, request2);
        }
      }
      L(message, request2) {
        if (this.R) {
          this.P(`${message}${typeof request2.correlationId === "number" ? ` <${request2.correlationId}> ` : ``}`);
        }
      }
      M(request2) {
        return `${request2.path} (excludes: ${request2.excludes.length > 0 ? request2.excludes : "<none>"}, includes: ${request2.includes && request2.includes.length > 0 ? JSON.stringify(request2.includes) : "<all>"}, filter: ${$et(request2.filter)}, correlationId: ${typeof request2.correlationId === "number" ? request2.correlationId : "<none>"})`;
      }
      async setVerboseLogging(enabled) {
        this.R = enabled;
      }
    };
  }
});

// out-build/vs/base/node/extpath.js
import * as fs6 from "fs";
async function $4s(path7, token) {
  if ($n) {
    return path7;
  }
  const dir = $qc(path7);
  if (path7 === dir) {
    return path7;
  }
  const name = ($rc(path7) || path7).toLowerCase();
  try {
    if (token?.isCancellationRequested) {
      return null;
    }
    const entries = await Promises2.readdir(dir);
    const found = entries.filter((e) => e.toLowerCase() === name);
    if (found.length === 1) {
      const prefix = await $4s(dir, token);
      if (prefix) {
        return $nc(prefix, found[0]);
      }
    } else if (found.length > 1) {
      const ix = found.indexOf(name);
      if (ix >= 0) {
        const prefix = await $4s(dir, token);
        if (prefix) {
          return $nc(prefix, found[ix]);
        }
      }
    }
  } catch (error) {
  }
  return null;
}
var init_extpath2 = __esm({
  "out-build/vs/base/node/extpath.js"() {
    "use strict";
    init_path();
    init_platform();
    init_strings();
    init_pfs();
  }
});

// out-build/vs/platform/files/node/watcher/nodejs/nodejsWatcherLib.js
import { watch, promises as promises8 } from "fs";
var $ft;
var init_nodejsWatcherLib = __esm({
  "out-build/vs/platform/files/node/watcher/nodejs/nodejsWatcherLib.js"() {
    "use strict";
    init_async();
    init_cancellation();
    init_extpath();
    init_lifecycle();
    init_normalization();
    init_path();
    init_platform();
    init_resources();
    init_uri();
    init_extpath2();
    init_pfs();
    init_watcher();
    $ft = class _$ft extends $3c {
      static {
        this.a = 100;
      }
      static {
        this.b = 75;
      }
      get isReusingRecursiveWatcher() {
        return this.n;
      }
      get failed() {
        return this.r;
      }
      constructor(s, t, u, w, y, z) {
        super();
        this.s = s;
        this.t = t;
        this.u = u;
        this.w = w;
        this.y = y;
        this.z = z;
        this.c = this.B(new $$h({
          maxWorkChunkSize: 100,
          // only process up to 100 changes at once before...
          throttleDelay: 200,
          // ...resting for 200ms until we process events again...
          maxBufferedWork: 1e4
          // ...but never buffering more than 10000 events in memory
        }, (events) => this.u(events)));
        this.f = this.B(new $0h((events) => this.M(events), _$ft.b));
        this.g = $ct(this.s.path, this.s.excludes);
        this.h = this.s.includes ? $ct(this.s.path, this.s.includes) : void 0;
        this.j = $7s(this.s) ? this.s.filter : void 0;
        this.m = new $ad();
        this.ready = this.C();
        this.n = false;
        this.r = false;
      }
      async C() {
        try {
          const realPath = await this.F(this.s);
          if (this.m.token.isCancellationRequested) {
            return;
          }
          const stat = await promises8.stat(realPath);
          if (this.m.token.isCancellationRequested) {
            return;
          }
          this.B(await this.G(realPath, stat.isDirectory()));
        } catch (error) {
          if (error.code !== "ENOENT") {
            this.O(error);
          } else {
            this.Q(`ignoring a path for watching who's stat info failed to resolve: ${this.s.path} (error: ${error})`);
          }
          this.D();
        }
      }
      D() {
        this.r = true;
        this.w?.();
      }
      async F(request2) {
        let realPath = request2.path;
        try {
          realPath = await Promises2.realpath(request2.path);
          if (request2.path === realPath) {
            realPath = await $4s(request2.path, this.m.token) ?? request2.path;
          }
          if (request2.path !== realPath) {
            this.Q(`correcting a path to watch that seems to be a symbolic link or wrong casing (original: ${request2.path}, real: ${realPath})`);
          }
        } catch (error) {
        }
        return realPath;
      }
      async G(realPath, isDirectory) {
        const disposables = new $2c();
        if (this.H(realPath, isDirectory, disposables)) {
          this.Q(`reusing an existing recursive watcher for ${this.s.path}`);
          this.n = true;
        } else {
          this.n = false;
          await this.I(realPath, isDirectory, disposables);
        }
        return disposables;
      }
      H(realPath, isDirectory, disposables) {
        if (isDirectory) {
          return false;
        }
        const resource = URI.file(this.s.path);
        const subscription = this.t?.subscribe(this.s.path, async (error, change) => {
          if (disposables.isDisposed) {
            return;
          }
          if (error) {
            const watchDisposable = await this.G(realPath, isDirectory);
            if (!disposables.isDisposed) {
              disposables.add(watchDisposable);
            } else {
              watchDisposable.dispose();
            }
          } else if (change) {
            if (typeof change.cId === "number" || typeof this.s.correlationId === "number") {
              this.L(
                { resource, type: change.type, cId: this.s.correlationId },
                true
                /* skip excludes/includes (file is explicitly watched) */
              );
            }
          }
        });
        if (subscription) {
          disposables.add(subscription);
          return true;
        }
        return false;
      }
      async I(realPath, isDirectory, disposables) {
        if ($m && $Zg(realPath, "/Volumes/", true)) {
          this.O(`Refusing to watch ${realPath} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);
          return;
        }
        const cts = new $ad(this.m.token);
        disposables.add($1c(() => cts.dispose(true)));
        const watcherDisposables = new $2c();
        disposables.add(watcherDisposables);
        try {
          const requestResource = URI.file(this.s.path);
          const pathBasename = $rc(realPath);
          const watcher = watch(realPath);
          watcherDisposables.add($1c(() => {
            watcher.removeAllListeners();
            watcher.close();
          }));
          this.Q(`Started watching: '${realPath}'`);
          const folderChildren = /* @__PURE__ */ new Set();
          if (isDirectory) {
            try {
              for (const child of await Promises2.readdir(realPath)) {
                folderChildren.add(child);
              }
            } catch (error) {
              this.O(error);
            }
          }
          if (cts.token.isCancellationRequested) {
            return;
          }
          const mapPathToStatDisposable = /* @__PURE__ */ new Map();
          watcherDisposables.add($1c(() => {
            for (const [, disposable] of mapPathToStatDisposable) {
              disposable.dispose();
            }
            mapPathToStatDisposable.clear();
          }));
          watcher.on("error", (code, signal) => {
            if (cts.token.isCancellationRequested) {
              return;
            }
            this.O(`Failed to watch ${realPath} for changes using fs.watch() (${code}, ${signal})`);
            this.D();
          });
          watcher.on("change", (type2, raw) => {
            if (cts.token.isCancellationRequested) {
              return;
            }
            if (this.z) {
              this.R(`[raw] ["${type2}"] ${raw}`);
            }
            let changedFileName = "";
            if (raw) {
              changedFileName = raw.toString();
              if ($m) {
                changedFileName = $Qs(changedFileName);
              }
            }
            if (!changedFileName || type2 !== "change" && type2 !== "rename") {
              return;
            }
            if (isDirectory) {
              if (type2 === "rename") {
                mapPathToStatDisposable.get(changedFileName)?.dispose();
                const timeoutHandle = setTimeout(async () => {
                  mapPathToStatDisposable.delete(changedFileName);
                  if (changedFileName === pathBasename && !await Promises2.exists(realPath)) {
                    this.J(requestResource);
                    return;
                  }
                  if (cts.token.isCancellationRequested) {
                    return;
                  }
                  const fileExists = await this.N($nc(realPath, changedFileName));
                  if (cts.token.isCancellationRequested) {
                    return;
                  }
                  let type3;
                  if (fileExists) {
                    if (folderChildren.has(changedFileName)) {
                      type3 = 0;
                    } else {
                      type3 = 1;
                      folderChildren.add(changedFileName);
                    }
                  } else {
                    folderChildren.delete(changedFileName);
                    type3 = 2;
                  }
                  this.L({ resource: $vh(requestResource, changedFileName), type: type3, cId: this.s.correlationId });
                }, _$ft.a);
                mapPathToStatDisposable.set(changedFileName, $1c(() => clearTimeout(timeoutHandle)));
              } else {
                let type3;
                if (folderChildren.has(changedFileName)) {
                  type3 = 0;
                } else {
                  type3 = 1;
                  folderChildren.add(changedFileName);
                }
                this.L({ resource: $vh(requestResource, changedFileName), type: type3, cId: this.s.correlationId });
              }
            } else {
              if (type2 === "rename" || changedFileName !== pathBasename) {
                const timeoutHandle = setTimeout(async () => {
                  const fileExists = await Promises2.exists(realPath);
                  if (cts.token.isCancellationRequested) {
                    return;
                  }
                  if (fileExists) {
                    this.L(
                      { resource: requestResource, type: 0, cId: this.s.correlationId },
                      true
                      /* skip excludes/includes (file is explicitly watched) */
                    );
                    watcherDisposables.add(await this.G(realPath, false));
                  } else {
                    this.J(requestResource);
                  }
                }, _$ft.a);
                watcherDisposables.clear();
                watcherDisposables.add($1c(() => clearTimeout(timeoutHandle)));
              } else {
                this.L(
                  { resource: requestResource, type: 0, cId: this.s.correlationId },
                  true
                  /* skip excludes/includes (file is explicitly watched) */
                );
              }
            }
          });
        } catch (error) {
          if (!cts.token.isCancellationRequested) {
            this.O(`Failed to watch ${realPath} for changes using fs.watch() (${error.toString()})`);
          }
          this.D();
        }
      }
      J(resource) {
        this.P("Watcher shutdown because watched path got deleted");
        this.L(
          { resource, type: 2, cId: this.s.correlationId },
          true
          /* skip excludes/includes (file is explicitly watched) */
        );
        this.f.flush();
        this.D();
      }
      L(event, skipIncludeExcludeChecks = false) {
        if (this.m.token.isCancellationRequested) {
          return;
        }
        if (this.z) {
          this.R(`${event.type === 1 ? "[ADDED]" : event.type === 2 ? "[DELETED]" : "[CHANGED]"} ${event.resource.fsPath}`);
        }
        if (!skipIncludeExcludeChecks && this.g.some((exclude) => exclude(event.resource.fsPath))) {
          if (this.z) {
            this.R(` >> ignored (excluded) ${event.resource.fsPath}`);
          }
        } else if (!skipIncludeExcludeChecks && this.h && this.h.length > 0 && !this.h.some((include) => include(event.resource.fsPath))) {
          if (this.z) {
            this.R(` >> ignored (not included) ${event.resource.fsPath}`);
          }
        } else {
          this.f.work(event);
        }
      }
      M(fileChanges) {
        const coalescedFileChanges = $at(fileChanges);
        const filteredEvents = [];
        for (const event of coalescedFileChanges) {
          if ($dt(event, this.j)) {
            if (this.z) {
              this.R(` >> ignored (filtered) ${event.resource.fsPath}`);
            }
            continue;
          }
          filteredEvents.push(event);
        }
        if (filteredEvents.length === 0) {
          return;
        }
        if (this.z) {
          for (const event of filteredEvents) {
            this.R(` >> normalized ${event.type === 1 ? "[ADDED]" : event.type === 2 ? "[DELETED]" : "[CHANGED]"} ${event.resource.fsPath}`);
          }
        }
        const worked = this.c.work(filteredEvents);
        if (!worked) {
          this.P(`started ignoring events due to too many file change events at once (incoming: ${filteredEvents.length}, most recent change: ${filteredEvents[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`);
        } else {
          if (this.c.pending > 0) {
            this.Q(`started throttling events due to large amount of file change events at once (pending: ${this.c.pending}, most recent change: ${filteredEvents[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`);
          }
        }
      }
      async N(path7) {
        if ($n) {
          return Promises2.exists(path7);
        }
        try {
          const pathBasename = $rc(path7);
          const children = await Promises2.readdir($qc(path7));
          return children.some((child) => child === pathBasename);
        } catch (error) {
          this.Q(error);
          return false;
        }
      }
      setVerboseLogging(verboseLogging) {
        this.z = verboseLogging;
      }
      O(error) {
        if (!this.m.token.isCancellationRequested) {
          this.y?.({ type: "error", message: `[File Watcher (node.js)] ${error}` });
        }
      }
      P(message) {
        if (!this.m.token.isCancellationRequested) {
          this.y?.({ type: "warn", message: `[File Watcher (node.js)] ${message}` });
        }
      }
      Q(message) {
        if (!this.m.token.isCancellationRequested && this.z) {
          this.y?.({ type: "trace", message: `[File Watcher (node.js)] ${message}` });
        }
      }
      R(message) {
        if (!this.m.token.isCancellationRequested && this.z) {
          this.Q(`${message}${typeof this.s.correlationId === "number" ? ` <${this.s.correlationId}> ` : ``}`);
        }
      }
      dispose() {
        this.m.dispose(true);
        super.dispose();
      }
    };
  }
});

// out-build/vs/platform/files/node/watcher/nodejs/nodejsWatcher.js
var $oy;
var init_nodejsWatcher = __esm({
  "out-build/vs/platform/files/node/watcher/nodejs/nodejsWatcher.js"() {
    "use strict";
    init_event();
    init_glob();
    init_baseWatcher();
    init_platform();
    init_nodejsWatcherLib();
    init_extpath();
    $oy = class extends $ny {
      constructor(O) {
        super();
        this.O = O;
        this.onDidError = Event.None;
        this.watchers = /* @__PURE__ */ new Set();
      }
      async N(requests) {
        requests = this.Z(requests);
        const requestsToStart = [];
        const watchersToStop = new Set(Array.from(this.watchers));
        for (const request2 of requests) {
          const watcher = this.W(request2);
          if (watcher && $Hl(watcher.request.excludes, request2.excludes) && $Hl(watcher.request.includes, request2.includes)) {
            watchersToStop.delete(watcher);
          } else {
            requestsToStart.push(request2);
          }
        }
        if (requestsToStart.length) {
          this.P(`Request to start watching: ${requestsToStart.map((request2) => this.M(request2)).join(",")}`);
        }
        if (watchersToStop.size) {
          this.P(`Request to stop watching: ${Array.from(watchersToStop).map((watcher) => this.M(watcher.request)).join(",")}`);
        }
        for (const watcher of watchersToStop) {
          this.Y(watcher);
        }
        for (const request2 of requestsToStart) {
          this.X(request2);
        }
      }
      W(request2) {
        for (const watcher of this.watchers) {
          if (typeof request2.correlationId === "number" || typeof watcher.request.correlationId === "number") {
            if (watcher.request.correlationId === request2.correlationId) {
              return watcher;
            }
          } else {
            if ($Yg(
              watcher.request.path,
              request2.path,
              !$n
              /* ignorecase */
            )) {
              return watcher;
            }
          }
        }
        return void 0;
      }
      X(request2) {
        const instance = new $ft(request2, this.O, (changes) => this.a.fire(changes), () => this.c.fire(request2), (msg) => this.b.fire(msg), this.R);
        const watcher = { request: request2, instance };
        this.watchers.add(watcher);
      }
      async stop() {
        await super.stop();
        for (const watcher of this.watchers) {
          this.Y(watcher);
        }
      }
      Y(watcher) {
        this.P(`stopping file watcher`, watcher);
        this.watchers.delete(watcher);
        watcher.instance.dispose();
      }
      Z(requests) {
        const mapCorrelationtoRequests = /* @__PURE__ */ new Map();
        for (const request2 of requests) {
          const path7 = $n ? request2.path : request2.path.toLowerCase();
          let requestsForCorrelation = mapCorrelationtoRequests.get(request2.correlationId);
          if (!requestsForCorrelation) {
            requestsForCorrelation = /* @__PURE__ */ new Map();
            mapCorrelationtoRequests.set(request2.correlationId, requestsForCorrelation);
          }
          if (requestsForCorrelation.has(path7)) {
            this.P(`ignoring a request for watching who's path is already watched: ${this.M(request2)}`);
          }
          requestsForCorrelation.set(path7, request2);
        }
        return Array.from(mapCorrelationtoRequests.values()).map((requests2) => Array.from(requests2.values())).flat();
      }
      async setVerboseLogging(enabled) {
        super.setVerboseLogging(enabled);
        for (const watcher of this.watchers) {
          watcher.instance.setVerboseLogging(enabled);
        }
      }
      P(message, watcher) {
        if (this.R) {
          this.b.fire({ type: "trace", message: this.bb(message, watcher) });
        }
      }
      Q(message) {
        this.b.fire({ type: "warn", message: this.bb(message) });
      }
      bb(message, watcher) {
        return watcher ? `[File Watcher (node.js)] ${message} (${this.M(watcher.request)})` : `[File Watcher (node.js)] ${message}`;
      }
    };
  }
});

// out-build/vs/platform/files/node/watcher/nodejs/nodejsClient.js
var $py;
var init_nodejsClient = __esm({
  "out-build/vs/platform/files/node/watcher/nodejs/nodejsClient.js"() {
    "use strict";
    init_watcher();
    init_nodejsWatcher();
    $py = class extends $0s {
      constructor(onFileChanges, onLogMessage, verboseLogging) {
        super(onFileChanges, onLogMessage, verboseLogging);
        this.s();
      }
      r(disposables) {
        return disposables.add(new $oy(
          void 0
          /* no recursive watching support here */
        ));
      }
    };
  }
});

// out-build/vs/platform/files/node/diskFileSystemProvider.js
import { promises as promises9 } from "fs";
var $qy;
var init_diskFileSystemProvider2 = __esm({
  "out-build/vs/platform/files/node/diskFileSystemProvider.js"() {
    "use strict";
    init_async();
    init_map();
    init_buffer();
    init_event();
    init_extpath();
    init_lifecycle();
    init_path();
    init_platform();
    init_resources();
    init_stream();
    init_pfs();
    init_nls2();
    init_files();
    init_io();
    init_diskFileSystemProvider();
    init_watcherClient();
    init_nodejsClient();
    $qy = class _$qy extends $fy {
      static {
        this.M = false;
      }
      // not enabled by default because very spammy
      constructor(logService, options2) {
        super(logService, options2);
        this.onDidChangeCapabilities = Event.None;
        this.Q = new $Ec((resource) => $mh.getComparisonKey(resource));
        this.Y = /* @__PURE__ */ new Map();
        this.Z = /* @__PURE__ */ new Map();
        this.$ = /* @__PURE__ */ new Map();
      }
      get capabilities() {
        if (!this.N) {
          this.N = 2 | 4 | 16 | 8 | 8192 | 16384 | 32768 | 65536 | 131072;
          if ($n) {
            this.N |= 1024;
          }
        }
        return this.N;
      }
      //#endregion
      //#region File Metadata Resolving
      async stat(resource) {
        try {
          const { stat, symbolicLink } = await SymlinkSupport.stat(this.J(resource));
          return {
            type: this.P(stat, symbolicLink),
            ctime: stat.birthtime.getTime(),
            // intentionally not using ctime here, we want the creation time
            mtime: stat.mtime.getTime(),
            size: stat.size,
            permissions: (stat.mode & 128) === 0 ? FilePermission.Locked : void 0
          };
        } catch (error) {
          throw this.ib(error);
        }
      }
      async O(resource) {
        try {
          return await this.stat(resource);
        } catch (error) {
          return void 0;
        }
      }
      async readdir(resource) {
        try {
          const children = await Promises2.readdir(this.J(resource), { withFileTypes: true });
          const result = [];
          await Promise.all(children.map(async (child) => {
            try {
              let type2;
              if (child.isSymbolicLink()) {
                type2 = (await this.stat($vh(resource, child.name))).type;
              } else {
                type2 = this.P(child);
              }
              result.push([child.name, type2]);
            } catch (error) {
              this.a.trace(error);
            }
          }));
          return result;
        } catch (error) {
          throw this.ib(error);
        }
      }
      P(entry, symbolicLink) {
        let type2;
        if (symbolicLink?.dangling) {
          type2 = FileType.Unknown;
        } else if (entry.isFile()) {
          type2 = FileType.File;
        } else if (entry.isDirectory()) {
          type2 = FileType.Directory;
        } else {
          type2 = FileType.Unknown;
        }
        if (symbolicLink) {
          type2 |= FileType.SymbolicLink;
        }
        return type2;
      }
      async R(resource) {
        const filePath = this.J(resource);
        this.S(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${filePath})`);
        let existingLock = void 0;
        while (existingLock = this.Q.get(resource)) {
          this.S(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${filePath})`);
          await existingLock.wait();
        }
        const newLock = new $Uh();
        this.Q.set(resource, newLock);
        this.S(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${filePath})`);
        return $1c(() => {
          this.S(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${filePath})`);
          if (this.Q.get(resource) === newLock) {
            this.S(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${filePath})`);
            this.Q.delete(resource);
          }
          this.S(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${filePath})`);
          newLock.open();
        });
      }
      async readFile(resource, options2) {
        let lock = void 0;
        try {
          if (options2?.atomic) {
            this.S(`[Disk FileSystemProvider]: atomic read operation started (${this.J(resource)})`);
            lock = await this.R(resource);
          }
          const filePath = this.J(resource);
          return await promises9.readFile(filePath);
        } catch (error) {
          throw this.ib(error);
        } finally {
          lock?.dispose();
        }
      }
      S(msg) {
        if (_$qy.M) {
          this.a.trace(msg);
        }
      }
      readFileStream(resource, opts, token) {
        const stream = $qi((data) => $Ci.concat(data.map((data2) => $Ci.wrap(data2))).buffer);
        $ey(this, resource, stream, (data) => data.buffer, {
          ...opts,
          bufferSize: 256 * 1024
          // read into chunks of 256kb each to reduce IPC overhead
        }, token);
        return stream;
      }
      async writeFile(resource, content, opts) {
        if (opts?.atomic !== false && opts?.atomic?.postfix && await this.U(resource)) {
          return this.W(resource, $vh($uh(resource), `${$sh(resource)}${opts.atomic.postfix}`), content, opts);
        } else {
          return this.X(resource, content, opts);
        }
      }
      async U(resource) {
        try {
          const filePath = this.J(resource);
          const { symbolicLink } = await SymlinkSupport.stat(filePath);
          if (symbolicLink) {
            return false;
          }
        } catch (error) {
        }
        return true;
      }
      async W(resource, tempResource, content, opts) {
        const locks = new $2c();
        try {
          locks.add(await this.R(resource));
          locks.add(await this.R(tempResource));
          await this.X(
            tempResource,
            content,
            opts,
            true
            /* disable write lock */
          );
          try {
            await this.rename(tempResource, resource, { overwrite: true });
          } catch (error) {
            try {
              await this.delete(tempResource, { recursive: false, useTrash: false, atomic: false });
            } catch (error2) {
            }
            throw error;
          }
        } finally {
          locks.dispose();
        }
      }
      async X(resource, content, opts, disableWriteLock) {
        let handle = void 0;
        try {
          const filePath = this.J(resource);
          if (!opts.create || !opts.overwrite) {
            const fileExists = await Promises2.exists(filePath);
            if (fileExists) {
              if (!opts.overwrite) {
                throw $xm(localize(1946, null), FileSystemProviderErrorCode.FileExists);
              }
            } else {
              if (!opts.create) {
                throw $xm(localize(1947, null), FileSystemProviderErrorCode.FileNotFound);
              }
            }
          }
          handle = await this.open(resource, { create: true, unlock: opts.unlock }, disableWriteLock);
          await this.write(handle, 0, content, 0, content.byteLength);
        } catch (error) {
          throw await this.jb(resource, error);
        } finally {
          if (typeof handle === "number") {
            await this.close(handle);
          }
        }
      }
      static {
        this.ab = true;
      }
      static configureFlushOnWrite(enabled) {
        _$qy.ab = enabled;
      }
      async open(resource, opts, disableWriteLock) {
        const filePath = this.J(resource);
        let lock = void 0;
        if ($lm(opts) && !disableWriteLock) {
          lock = await this.R(resource);
        }
        let fd = void 0;
        try {
          if ($lm(opts) && opts.unlock) {
            try {
              const { stat } = await SymlinkSupport.stat(filePath);
              if (!(stat.mode & 128)) {
                await promises9.chmod(filePath, stat.mode | 128);
              }
            } catch (error) {
              if (error.code !== "ENOENT") {
                this.a.trace(error);
              }
            }
          }
          if ($l && $lm(opts)) {
            try {
              fd = await Promises2.open(filePath, "r+");
              await Promises2.ftruncate(fd, 0);
            } catch (error) {
              if (error.code !== "ENOENT") {
                this.a.trace(error);
              }
              if (typeof fd === "number") {
                try {
                  await Promises2.close(fd);
                } catch (error2) {
                  this.a.trace(error2);
                }
                fd = void 0;
              }
            }
          }
          if (typeof fd !== "number") {
            fd = await Promises2.open(filePath, $lm(opts) ? (
              // We take `opts.create` as a hint that the file is opened for writing
              // as such we use 'w' to truncate an existing or create the
              // file otherwise. we do not allow reading.
              "w"
            ) : (
              // Otherwise we assume the file is opened for reading
              // as such we use 'r' to neither truncate, nor create
              // the file.
              "r"
            ));
          }
        } catch (error) {
          lock?.dispose();
          if ($lm(opts)) {
            throw await this.jb(resource, error);
          } else {
            throw this.ib(error);
          }
        }
        this.Y.set(fd, 0);
        if ($lm(opts)) {
          this.$.set(fd, resource);
        }
        if (lock) {
          const previousLock = this.Z.get(fd);
          this.S(`[Disk FileSystemProvider]: open() - storing lock for handle ${fd} (${filePath})`);
          this.Z.set(fd, lock);
          if (previousLock) {
            this.S(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${fd} (${filePath})`);
            previousLock.dispose();
          }
        }
        return fd;
      }
      async close(fd) {
        const lockForHandle = this.Z.get(fd);
        try {
          this.Y.delete(fd);
          if (this.$.delete(fd) && _$qy.ab) {
            try {
              await Promises2.fdatasync(fd);
            } catch (error) {
              _$qy.configureFlushOnWrite(false);
              this.a.error(error);
            }
          }
          return await Promises2.close(fd);
        } catch (error) {
          throw this.ib(error);
        } finally {
          if (lockForHandle) {
            if (this.Z.get(fd) === lockForHandle) {
              this.S(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${fd}`);
              this.Z.delete(fd);
            }
            this.S(`[Disk FileSystemProvider]: close() - disposing lock for handle ${fd}`);
            lockForHandle.dispose();
          }
        }
      }
      async read(fd, pos, data, offset, length) {
        const normalizedPos = this.bb(fd, pos);
        let bytesRead = null;
        try {
          bytesRead = (await Promises2.read(fd, data, offset, length, normalizedPos)).bytesRead;
        } catch (error) {
          throw this.ib(error);
        } finally {
          this.cb(fd, normalizedPos, bytesRead);
        }
        return bytesRead;
      }
      bb(fd, pos) {
        if (pos === this.Y.get(fd)) {
          return null;
        }
        return pos;
      }
      cb(fd, pos, bytesLength) {
        const lastKnownPos = this.Y.get(fd);
        if (typeof lastKnownPos === "number") {
          if (typeof pos === "number") {
          } else if (typeof bytesLength === "number") {
            this.Y.set(fd, lastKnownPos + bytesLength);
          } else {
            this.Y.delete(fd);
          }
        }
      }
      async write(fd, pos, data, offset, length) {
        return $di(
          () => this.db(fd, pos, data, offset, length),
          100,
          3
          /* retries */
        );
      }
      async db(fd, pos, data, offset, length) {
        const normalizedPos = this.bb(fd, pos);
        let bytesWritten = null;
        try {
          bytesWritten = (await Promises2.write(fd, data, offset, length, normalizedPos)).bytesWritten;
        } catch (error) {
          throw await this.jb(this.$.get(fd), error);
        } finally {
          this.cb(fd, normalizedPos, bytesWritten);
        }
        return bytesWritten;
      }
      //#endregion
      //#region Move/Copy/Delete/Create Folder
      async mkdir(resource) {
        try {
          await promises9.mkdir(this.J(resource));
        } catch (error) {
          throw this.ib(error);
        }
      }
      async delete(resource, opts) {
        try {
          const filePath = this.J(resource);
          if (opts.recursive) {
            let rmMoveToPath = void 0;
            if (opts?.atomic !== false && opts.atomic.postfix) {
              rmMoveToPath = $nc($qc(filePath), `${$rc(filePath)}${opts.atomic.postfix}`);
            }
            await Promises2.rm(filePath, RimRafMode.MOVE, rmMoveToPath);
          } else {
            try {
              await promises9.unlink(filePath);
            } catch (unlinkError) {
              if (unlinkError.code === "EPERM" || unlinkError.code === "EISDIR") {
                let isDirectory = false;
                try {
                  const { stat, symbolicLink } = await SymlinkSupport.stat(filePath);
                  isDirectory = stat.isDirectory() && !symbolicLink;
                } catch (statError) {
                }
                if (isDirectory) {
                  await promises9.rmdir(filePath);
                } else {
                  throw unlinkError;
                }
              } else {
                throw unlinkError;
              }
            }
          }
        } catch (error) {
          throw this.ib(error);
        }
      }
      async rename(from, to, opts) {
        const fromFilePath = this.J(from);
        const toFilePath = this.J(to);
        if (fromFilePath === toFilePath) {
          return;
        }
        try {
          await this.eb(from, to, "move", opts.overwrite);
          await Promises2.rename(fromFilePath, toFilePath);
        } catch (error) {
          if (error.code === "EINVAL" || error.code === "EBUSY" || error.code === "ENAMETOOLONG") {
            error = new Error(localize(1948, null, $rc(fromFilePath), $rc($qc(toFilePath)), error.toString()));
          }
          throw this.ib(error);
        }
      }
      async copy(from, to, opts) {
        const fromFilePath = this.J(from);
        const toFilePath = this.J(to);
        if (fromFilePath === toFilePath) {
          return;
        }
        try {
          await this.eb(from, to, "copy", opts.overwrite);
          await Promises2.copy(fromFilePath, toFilePath, { preserveSymlinks: true });
        } catch (error) {
          if (error.code === "EINVAL" || error.code === "EBUSY" || error.code === "ENAMETOOLONG") {
            error = new Error(localize(1949, null, $rc(fromFilePath), $rc($qc(toFilePath)), error.toString()));
          }
          throw this.ib(error);
        }
      }
      async eb(from, to, mode, overwrite) {
        const fromFilePath = this.J(from);
        const toFilePath = this.J(to);
        let isSameResourceWithDifferentPathCase = false;
        const isPathCaseSensitive = !!(this.capabilities & 1024);
        if (!isPathCaseSensitive) {
          isSameResourceWithDifferentPathCase = $Yg(
            fromFilePath,
            toFilePath,
            true
            /* ignore case */
          );
        }
        if (isSameResourceWithDifferentPathCase) {
          if (mode === "copy") {
            throw $xm(localize(1950, null), FileSystemProviderErrorCode.FileExists);
          } else if (mode === "move") {
            return;
          }
        }
        const fromStat = await this.O(from);
        if (!fromStat) {
          throw $xm(localize(1951, null), FileSystemProviderErrorCode.FileNotFound);
        }
        const toStat = await this.O(to);
        if (!toStat) {
          return;
        }
        if (!overwrite) {
          throw $xm(localize(1952, null), FileSystemProviderErrorCode.FileExists);
        }
        if ((fromStat.type & FileType.File) !== 0 && (toStat.type & FileType.File) !== 0) {
          return;
        } else {
          await this.delete(to, { recursive: true, useTrash: false, atomic: false });
        }
      }
      //#endregion
      //#region Clone File
      async cloneFile(from, to) {
        return this.fb(
          from,
          to,
          false
          /* optimistically assume parent folders exist */
        );
      }
      async fb(from, to, mkdir) {
        const fromFilePath = this.J(from);
        const toFilePath = this.J(to);
        const isPathCaseSensitive = !!(this.capabilities & 1024);
        if ($Yg(fromFilePath, toFilePath, !isPathCaseSensitive)) {
          return;
        }
        const locks = new $2c();
        try {
          locks.add(await this.R(from));
          locks.add(await this.R(to));
          if (mkdir) {
            await promises9.mkdir($qc(toFilePath), { recursive: true });
          }
          await promises9.copyFile(fromFilePath, toFilePath);
        } catch (error) {
          if (error.code === "ENOENT" && !mkdir) {
            return this.fb(from, to, true);
          }
          throw this.ib(error);
        } finally {
          locks.dispose();
        }
      }
      //#endregion
      //#region File Watching
      u(onChange, onLogMessage, verboseLogging) {
        return new $my((changes) => onChange(changes), (msg) => onLogMessage(msg), verboseLogging);
      }
      G(onChange, onLogMessage, verboseLogging) {
        return new $py((changes) => onChange(changes), (msg) => onLogMessage(msg), verboseLogging);
      }
      //#endregion
      //#region Helpers
      ib(error) {
        if (error instanceof $wm) {
          return error;
        }
        let resultError = error;
        let code;
        switch (error.code) {
          case "ENOENT":
            code = FileSystemProviderErrorCode.FileNotFound;
            break;
          case "EISDIR":
            code = FileSystemProviderErrorCode.FileIsADirectory;
            break;
          case "ENOTDIR":
            code = FileSystemProviderErrorCode.FileNotADirectory;
            break;
          case "EEXIST":
            code = FileSystemProviderErrorCode.FileExists;
            break;
          case "EPERM":
          case "EACCES":
            code = FileSystemProviderErrorCode.NoPermissions;
            break;
          case "ERR_UNC_HOST_NOT_ALLOWED":
            resultError = `${error.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`;
            code = FileSystemProviderErrorCode.Unknown;
            break;
          default:
            code = FileSystemProviderErrorCode.Unknown;
        }
        return $xm(resultError, code);
      }
      async jb(resource, error) {
        let fileSystemProviderWriteError = this.ib(error);
        if (resource && fileSystemProviderWriteError.code === FileSystemProviderErrorCode.NoPermissions) {
          try {
            const { stat } = await SymlinkSupport.stat(this.J(resource));
            if (!(stat.mode & 128)) {
              fileSystemProviderWriteError = $xm(error, FileSystemProviderErrorCode.FileWriteLocked);
            }
          } catch (error2) {
            this.a.trace(error2);
          }
        }
        return fileSystemProviderWriteError;
      }
    };
  }
});

// out-build/vs/base/common/date.js
function $Tu(date) {
  return date.getFullYear() + "-" + String(date.getMonth() + 1).padStart(2, "0") + "-" + String(date.getDate()).padStart(2, "0") + "T" + String(date.getHours()).padStart(2, "0") + ":" + String(date.getMinutes()).padStart(2, "0") + ":" + String(date.getSeconds()).padStart(2, "0") + "." + (date.getMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
}
var minute, hour, day, week, month, year;
var init_date = __esm({
  "out-build/vs/base/common/date.js"() {
    "use strict";
    init_nls2();
    init_platform();
    minute = 60;
    hour = minute * 60;
    day = hour * 24;
    week = day * 7;
    month = day * 30;
    year = day * 365;
  }
});

// out-build/vs/platform/environment/common/environmentService.js
function $Zu(args, isBuilt) {
  return $1u(args["inspect-extensions"], args["inspect-brk-extensions"], 5870, isBuilt, args.debugId, args.extensionEnvironment);
}
function $1u(debugArg, debugBrkArg, defaultBuildPort, isBuilt, debugId, environmentString) {
  const portStr = debugBrkArg || debugArg;
  const port = Number(portStr) || (!isBuilt ? defaultBuildPort : null);
  const brk = port ? Boolean(!!debugBrkArg) : false;
  let env2;
  if (environmentString) {
    try {
      env2 = JSON.parse(environmentString);
    } catch {
    }
  }
  return { port, break: brk, debugId, env: env2 };
}
var $Xu, $Yu;
var init_environmentService = __esm({
  "out-build/vs/platform/environment/common/environmentService.js"() {
    "use strict";
    init_date();
    init_decorators();
    init_network();
    init_path();
    init_process();
    init_resources();
    init_uri();
    $Xu = /^([^.]+\..+)[:=](.+)$/;
    $Yu = class {
      get appRoot() {
        return $qc($ih.asFileUri("").fsPath);
      }
      get userHome() {
        return URI.file(this.b.homeDir);
      }
      get userDataPath() {
        return this.b.userDataDir;
      }
      get appSettingsHome() {
        return URI.file($nc(this.userDataPath, "User"));
      }
      get tmpDir() {
        return URI.file(this.b.tmpDir);
      }
      get cacheHome() {
        return URI.file(this.userDataPath);
      }
      get stateResource() {
        return $vh(this.appSettingsHome, "globalStorage", "storage.json");
      }
      get userRoamingDataHome() {
        return this.appSettingsHome.with({ scheme: Schemas.vscodeUserData });
      }
      get userDataSyncHome() {
        return $vh(this.appSettingsHome, "sync");
      }
      get logsHome() {
        if (!this.args.logsPath) {
          const key = $Tu(/* @__PURE__ */ new Date()).replace(/-|:|\.\d+Z$/g, "");
          this.args.logsPath = $nc(this.userDataPath, "logs", key);
        }
        return URI.file(this.args.logsPath);
      }
      get sync() {
        return this.args.sync;
      }
      get machineSettingsResource() {
        return $vh(URI.file($nc(this.userDataPath, "Machine")), "settings.json");
      }
      get workspaceStorageHome() {
        return $vh(this.appSettingsHome, "workspaceStorage");
      }
      get localHistoryHome() {
        return $vh(this.appSettingsHome, "History");
      }
      get keyboardLayoutResource() {
        return $vh(this.userRoamingDataHome, "keyboardLayout.json");
      }
      get argvResource() {
        const vscodePortable = env["VSCODE_PORTABLE"];
        if (vscodePortable) {
          return URI.file($nc(vscodePortable, "argv.json"));
        }
        return $vh(this.userHome, this.c.dataFolderName, "argv.json");
      }
      get isExtensionDevelopment() {
        return !!this.args.extensionDevelopmentPath;
      }
      get untitledWorkspacesHome() {
        return URI.file($nc(this.userDataPath, "Workspaces"));
      }
      get builtinExtensionsPath() {
        const cliBuiltinExtensionsDir = this.args["builtin-extensions-dir"];
        if (cliBuiltinExtensionsDir) {
          return $oc(cliBuiltinExtensionsDir);
        }
        return $lc($nc($ih.asFileUri("").fsPath, "..", "extensions"));
      }
      get extensionsDownloadLocation() {
        const cliExtensionsDownloadDir = this.args["extensions-download-dir"];
        if (cliExtensionsDownloadDir) {
          return URI.file($oc(cliExtensionsDownloadDir));
        }
        return URI.file($nc(this.userDataPath, "CachedExtensionVSIXs"));
      }
      get extensionsPath() {
        const cliExtensionsDir = this.args["extensions-dir"];
        if (cliExtensionsDir) {
          return $oc(cliExtensionsDir);
        }
        const vscodeExtensions = env["VSCODE_EXTENSIONS"];
        if (vscodeExtensions) {
          return vscodeExtensions;
        }
        const vscodePortable = env["VSCODE_PORTABLE"];
        if (vscodePortable) {
          return $nc(vscodePortable, "extensions");
        }
        return $vh(this.userHome, this.c.dataFolderName, "extensions").fsPath;
      }
      get extensionDevelopmentLocationURI() {
        const extensionDevelopmentPaths = this.args.extensionDevelopmentPath;
        if (Array.isArray(extensionDevelopmentPaths)) {
          return extensionDevelopmentPaths.map((extensionDevelopmentPath) => {
            if (/^[^:/?#]+?:\/\//.test(extensionDevelopmentPath)) {
              return URI.parse(extensionDevelopmentPath);
            }
            return URI.file($lc(extensionDevelopmentPath));
          });
        }
        return void 0;
      }
      get extensionDevelopmentKind() {
        return this.args.extensionDevelopmentKind?.map((kind) => kind === "ui" || kind === "workspace" || kind === "web" ? kind : "workspace");
      }
      get extensionTestsLocationURI() {
        const extensionTestsPath = this.args.extensionTestsPath;
        if (extensionTestsPath) {
          if (/^[^:/?#]+?:\/\//.test(extensionTestsPath)) {
            return URI.parse(extensionTestsPath);
          }
          return URI.file($lc(extensionTestsPath));
        }
        return void 0;
      }
      get disableExtensions() {
        if (this.args["disable-extensions"]) {
          return true;
        }
        const disableExtensions = this.args["disable-extension"];
        if (disableExtensions) {
          if (typeof disableExtensions === "string") {
            return [disableExtensions];
          }
          if (Array.isArray(disableExtensions) && disableExtensions.length > 0) {
            return disableExtensions;
          }
        }
        return false;
      }
      get debugExtensionHost() {
        return $Zu(this.args, this.isBuilt);
      }
      get debugRenderer() {
        return !!this.args.debugRenderer;
      }
      get isBuilt() {
        return !env["VSCODE_DEV"];
      }
      get verbose() {
        return !!this.args.verbose;
      }
      get logLevel() {
        return this.args.log?.find((entry) => !$Xu.test(entry));
      }
      get extensionLogLevel() {
        const result = [];
        for (const entry of this.args.log || []) {
          const matches = $Xu.exec(entry);
          if (matches && matches[1] && matches[2]) {
            result.push([matches[1], matches[2]]);
          }
        }
        return result.length ? result : void 0;
      }
      get serviceMachineIdResource() {
        return $vh(URI.file(this.userDataPath), "machineid");
      }
      get crashReporterId() {
        return this.args["crash-reporter-id"];
      }
      get crashReporterDirectory() {
        return this.args["crash-reporter-directory"];
      }
      get disableTelemetry() {
        return !!this.args["disable-telemetry"];
      }
      get disableWorkspaceTrust() {
        return !!this.args["disable-workspace-trust"];
      }
      get useInMemorySecretStorage() {
        return !!this.args["use-inmemory-secretstorage"];
      }
      get policyFile() {
        if (this.args["__enable-file-policy"]) {
          const vscodePortable = env["VSCODE_PORTABLE"];
          if (vscodePortable) {
            return URI.file($nc(vscodePortable, "policy.json"));
          }
          return $vh(this.userHome, this.c.dataFolderName, "policy.json");
        }
        return void 0;
      }
      get continueOn() {
        return this.args["continueOn"];
      }
      set continueOn(value) {
        this.args["continueOn"] = value;
      }
      get args() {
        return this.a;
      }
      constructor(a, b, c) {
        this.a = a;
        this.b = b;
        this.c = c;
        this.editSessionId = this.args["editSessionId"];
      }
    };
    __decorate([
      $0t
    ], $Yu.prototype, "appRoot", null);
    __decorate([
      $0t
    ], $Yu.prototype, "userHome", null);
    __decorate([
      $0t
    ], $Yu.prototype, "userDataPath", null);
    __decorate([
      $0t
    ], $Yu.prototype, "appSettingsHome", null);
    __decorate([
      $0t
    ], $Yu.prototype, "tmpDir", null);
    __decorate([
      $0t
    ], $Yu.prototype, "cacheHome", null);
    __decorate([
      $0t
    ], $Yu.prototype, "stateResource", null);
    __decorate([
      $0t
    ], $Yu.prototype, "userRoamingDataHome", null);
    __decorate([
      $0t
    ], $Yu.prototype, "userDataSyncHome", null);
    __decorate([
      $0t
    ], $Yu.prototype, "sync", null);
    __decorate([
      $0t
    ], $Yu.prototype, "machineSettingsResource", null);
    __decorate([
      $0t
    ], $Yu.prototype, "workspaceStorageHome", null);
    __decorate([
      $0t
    ], $Yu.prototype, "localHistoryHome", null);
    __decorate([
      $0t
    ], $Yu.prototype, "keyboardLayoutResource", null);
    __decorate([
      $0t
    ], $Yu.prototype, "argvResource", null);
    __decorate([
      $0t
    ], $Yu.prototype, "isExtensionDevelopment", null);
    __decorate([
      $0t
    ], $Yu.prototype, "untitledWorkspacesHome", null);
    __decorate([
      $0t
    ], $Yu.prototype, "builtinExtensionsPath", null);
    __decorate([
      $0t
    ], $Yu.prototype, "extensionsPath", null);
    __decorate([
      $0t
    ], $Yu.prototype, "extensionDevelopmentLocationURI", null);
    __decorate([
      $0t
    ], $Yu.prototype, "extensionDevelopmentKind", null);
    __decorate([
      $0t
    ], $Yu.prototype, "extensionTestsLocationURI", null);
    __decorate([
      $0t
    ], $Yu.prototype, "debugExtensionHost", null);
    __decorate([
      $0t
    ], $Yu.prototype, "logLevel", null);
    __decorate([
      $0t
    ], $Yu.prototype, "extensionLogLevel", null);
    __decorate([
      $0t
    ], $Yu.prototype, "serviceMachineIdResource", null);
    __decorate([
      $0t
    ], $Yu.prototype, "disableTelemetry", null);
    __decorate([
      $0t
    ], $Yu.prototype, "disableWorkspaceTrust", null);
    __decorate([
      $0t
    ], $Yu.prototype, "useInMemorySecretStorage", null);
    __decorate([
      $0t
    ], $Yu.prototype, "policyFile", null);
  }
});

// out-build/vs/platform/environment/node/userDataPath.js
import * as os2 from "os";
import * as path4 from "path";
function $Gt(cliArgs, productName) {
  const userDataPath = doGetUserDataPath(cliArgs, productName);
  const pathsToResolve = [userDataPath];
  if (!path4.isAbsolute(userDataPath)) {
    pathsToResolve.unshift(cwd2);
  }
  return path4.resolve(...pathsToResolve);
}
function doGetUserDataPath(cliArgs, productName) {
  if (process.env["VSCODE_DEV"]) {
    productName = "code-oss-dev";
  }
  const portablePath = process.env["VSCODE_PORTABLE"];
  if (portablePath) {
    return path4.join(portablePath, "user-data");
  }
  let appDataPath = process.env["VSCODE_APPDATA"];
  if (appDataPath) {
    return path4.join(appDataPath, productName);
  }
  const cliPath = cliArgs["user-data-dir"];
  if (cliPath) {
    return cliPath;
  }
  switch (process.platform) {
    case "win32":
      appDataPath = process.env["APPDATA"];
      if (!appDataPath) {
        const userProfile = process.env["USERPROFILE"];
        if (typeof userProfile !== "string") {
          throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");
        }
        appDataPath = path4.join(userProfile, "AppData", "Roaming");
      }
      break;
    case "darwin":
      appDataPath = path4.join(os2.homedir(), "Library", "Application Support");
      break;
    case "linux":
      appDataPath = process.env["XDG_CONFIG_HOME"] || path4.join(os2.homedir(), ".config");
      break;
    default:
      throw new Error("Platform not supported");
  }
  return path4.join(appDataPath, productName);
}
var cwd2;
var init_userDataPath = __esm({
  "out-build/vs/platform/environment/node/userDataPath.js"() {
    "use strict";
    cwd2 = process.env["VSCODE_CWD"] || process.cwd();
  }
});

// out-build/vs/platform/environment/node/environmentService.js
import { homedir as homedir3, tmpdir as tmpdir2 } from "os";
function $3u(args, isBuilt) {
  return $1u(args["inspect-ptyhost"], args["inspect-brk-ptyhost"], 5877, isBuilt, args.extensionEnvironment);
}
var $2u;
var init_environmentService2 = __esm({
  "out-build/vs/platform/environment/node/environmentService.js"() {
    "use strict";
    init_environmentService();
    init_userDataPath();
    $2u = class extends $Yu {
      constructor(args, productService) {
        super(args, {
          homeDir: homedir3(),
          tmpDir: tmpdir2(),
          userDataDir: $Gt(args, productService.nameShort)
        }, productService);
      }
    };
  }
});

// out-build/vs/server/node/serverEnvironmentService.js
var $OW, $PW, $QW;
var init_serverEnvironmentService = __esm({
  "out-build/vs/server/node/serverEnvironmentService.js"() {
    "use strict";
    init_nls2();
    init_environmentService2();
    init_argv();
    init_instantiation();
    init_environment();
    init_decorators();
    $OW = {
      /* ----- server setup ----- */
      "host": { type: "string", cat: "o", args: "ip-address", description: localize(2551, null) },
      "port": { type: "string", cat: "o", args: "port | port range", description: localize(2552, null) },
      // --- Start PWB ---
      "cert-key": { type: "string", cat: "o", args: "path", description: localize(2553, null) },
      "cert": { type: "string", cat: "o", args: "path", description: localize(2554, null) },
      // --- End PWB ---
      "socket-path": { type: "string", cat: "o", args: "path", description: localize(2555, null) },
      "server-base-path": { type: "string", cat: "o", args: "path", description: localize(2556, null) },
      "connection-token": { type: "string", cat: "o", args: "token", deprecates: ["connectionToken"], description: localize(2557, null) },
      "connection-token-file": { type: "string", cat: "o", args: "path", deprecates: ["connection-secret", "connectionTokenFile"], description: localize(2558, null) },
      "without-connection-token": { type: "boolean", cat: "o", description: localize(2559, null) },
      "disable-websocket-compression": { type: "boolean" },
      "print-startup-performance": { type: "boolean" },
      "print-ip-address": { type: "boolean" },
      "accept-server-license-terms": { type: "boolean", cat: "o", description: localize(2560, null) },
      // --- Start PWB: disable file downloads ---
      "disable-file-downloads": { type: "boolean", cat: "o", description: localize(2561, null) },
      "disable-file-uploads": { type: "boolean", cat: "o", description: localize(2562, null) },
      // --- End PWB ---
      "server-data-dir": { type: "string", cat: "o", description: localize(2563, null) },
      "telemetry-level": { type: "string", cat: "o", args: "level", description: localize(2564, null) },
      /* ----- vs code options ---	-- */
      "user-data-dir": $it["user-data-dir"],
      "enable-smoke-test-driver": $it["enable-smoke-test-driver"],
      "disable-telemetry": $it["disable-telemetry"],
      "disable-workspace-trust": $it["disable-workspace-trust"],
      "file-watcher-polling": { type: "string", deprecates: ["fileWatcherPolling"] },
      "log": $it["log"],
      "logsPath": $it["logsPath"],
      "force-disable-user-env": $it["force-disable-user-env"],
      /* ----- vs code web options ----- */
      "folder": { type: "string", deprecationMessage: "No longer supported. Folder needs to be provided in the browser URL or with `default-folder`." },
      "workspace": { type: "string", deprecationMessage: "No longer supported. Workspace needs to be provided in the browser URL or with `default-workspace`." },
      "default-folder": { type: "string", description: localize(2565, null) },
      "default-workspace": { type: "string", description: localize(2566, null) },
      "enable-sync": { type: "boolean" },
      "github-auth": { type: "string" },
      "use-test-resolver": { type: "boolean" },
      /* ----- extension management ----- */
      "extensions-dir": $it["extensions-dir"],
      "extensions-download-dir": $it["extensions-download-dir"],
      "builtin-extensions-dir": $it["builtin-extensions-dir"],
      "install-extension": $it["install-extension"],
      "install-builtin-extension": $it["install-builtin-extension"],
      "update-extensions": $it["update-extensions"],
      "uninstall-extension": $it["uninstall-extension"],
      "list-extensions": $it["list-extensions"],
      "locate-extension": $it["locate-extension"],
      "show-versions": $it["show-versions"],
      "category": $it["category"],
      "force": $it["force"],
      "do-not-sync": $it["do-not-sync"],
      "pre-release": $it["pre-release"],
      "start-server": { type: "boolean", cat: "e", description: localize(2567, null) },
      /* ----- remote development options ----- */
      "enable-remote-auto-shutdown": { type: "boolean" },
      "remote-auto-shutdown-without-delay": { type: "boolean" },
      "use-host-proxy": { type: "boolean" },
      "without-browser-env-var": { type: "boolean" },
      /* ----- server cli ----- */
      "help": $it["help"],
      "version": $it["version"],
      "locate-shell-integration-path": $it["locate-shell-integration-path"],
      "compatibility": { type: "string" },
      _: $it["_"]
    };
    $PW = $Rk($Xk);
    $QW = class extends $2u {
      get userRoamingDataHome() {
        return this.appSettingsHome;
      }
      get args() {
        return super.args;
      }
    };
    __decorate([
      $0t
    ], $QW.prototype, "userRoamingDataHome", null);
  }
});

// out-build/vs/platform/extensionManagement/common/extensionManagementCLI.js
var notFound, useId, $bX;
var init_extensionManagementCLI = __esm({
  "out-build/vs/platform/extensionManagement/common/extensionManagementCLI.js"() {
    "use strict";
    init_cancellation();
    init_errors();
    init_network();
    init_resources();
    init_semver();
    init_uri();
    init_nls2();
    init_extensionManagement();
    init_extensionManagementUtil();
    init_extensions();
    notFound = (id2) => localize(1822, null, id2);
    useId = localize(1823, null, "ms-dotnettools.csharp");
    $bX = class $bX2 {
      constructor(a, b, d) {
        this.a = a;
        this.b = b;
        this.d = d;
      }
      get f() {
        return void 0;
      }
      async listExtensions(showVersions, category, profileLocation) {
        let extensions = await this.b.getInstalled(1, profileLocation);
        const categories = $4z.map((c) => c.toLowerCase());
        if (category && category !== "") {
          if (categories.indexOf(category.toLowerCase()) < 0) {
            this.a.info("Invalid category please enter a valid category. To list valid categories run --category without a category specified");
            return;
          }
          extensions = extensions.filter((e) => {
            if (e.manifest.categories) {
              const lowerCaseCategories = e.manifest.categories.map((c) => c.toLowerCase());
              return lowerCaseCategories.indexOf(category.toLowerCase()) > -1;
            }
            return false;
          });
        } else if (category === "") {
          this.a.info("Possible Categories: ");
          categories.forEach((category2) => {
            this.a.info(category2);
          });
          return;
        }
        if (this.f) {
          this.a.info(localize(1824, null, this.f));
        }
        extensions = extensions.sort((e1, e2) => e1.identifier.id.localeCompare(e2.identifier.id));
        let lastId = void 0;
        for (const extension of extensions) {
          if (lastId !== extension.identifier.id) {
            lastId = extension.identifier.id;
            this.a.info(showVersions ? `${lastId}@${extension.manifest.version}` : lastId);
          }
        }
      }
      async installExtensions(extensions, builtinExtensions, installOptions, force) {
        const failed = [];
        try {
          if (extensions.length) {
            this.a.info(this.f ? localize(1825, null, this.f) : localize(1826, null));
          }
          const installVSIXInfos = [];
          const installExtensionInfos = [];
          const addInstallExtensionInfo = (id2, version, isBuiltin) => {
            installExtensionInfos.push({ id: id2, version: version !== "prerelease" ? version : void 0, installOptions: { ...installOptions, isBuiltin, installPreReleaseVersion: version === "prerelease" || installOptions.installPreReleaseVersion } });
          };
          for (const extension of extensions) {
            if (extension instanceof URI) {
              installVSIXInfos.push({ vsix: extension, installOptions });
            } else {
              const [id2, version] = $FA(extension);
              addInstallExtensionInfo(id2, version, false);
            }
          }
          for (const extension of builtinExtensions) {
            if (extension instanceof URI) {
              installVSIXInfos.push({ vsix: extension, installOptions: { ...installOptions, isBuiltin: true, donotIncludePackAndDependencies: true } });
            } else {
              const [id2, version] = $FA(extension);
              addInstallExtensionInfo(id2, version, true);
            }
          }
          const installed = await this.b.getInstalled(void 0, installOptions.profileLocation);
          if (installVSIXInfos.length) {
            await Promise.all(installVSIXInfos.map(async ({ vsix, installOptions: installOptions2 }) => {
              try {
                await this.h(vsix, installOptions2, force, installed);
              } catch (err) {
                this.a.error(err);
                failed.push(vsix.toString());
              }
            }));
          }
          if (installExtensionInfos.length) {
            const failedGalleryExtensions = await this.g(installExtensionInfos, installed, force);
            failed.push(...failedGalleryExtensions);
          }
        } catch (error) {
          this.a.error(localize(1827, null, $qb(error)));
          throw error;
        }
        if (failed.length) {
          throw new Error(localize(1828, null, failed.join(", ")));
        }
      }
      async updateExtensions(profileLocation) {
        const installedExtensions = await this.b.getInstalled(1, profileLocation);
        const installedExtensionsQuery = [];
        for (const extension of installedExtensions) {
          if (!!extension.identifier.uuid) {
            installedExtensionsQuery.push({ ...extension.identifier, preRelease: extension.preRelease });
          }
        }
        this.a.trace(localize(1829, null, installedExtensionsQuery.length));
        const availableVersions = await this.d.getExtensions(installedExtensionsQuery, { compatible: true }, CancellationToken.None);
        const extensionsToUpdate = [];
        for (const newVersion of availableVersions) {
          for (const oldVersion of installedExtensions) {
            if ($DA(oldVersion.identifier, newVersion.identifier) && gt(newVersion.version, oldVersion.manifest.version)) {
              extensionsToUpdate.push({
                extension: newVersion,
                options: { operation: 3, installPreReleaseVersion: oldVersion.preRelease, profileLocation, isApplicationScoped: oldVersion.isApplicationScoped }
              });
            }
          }
        }
        if (!extensionsToUpdate.length) {
          this.a.info(localize(1830, null));
          return;
        }
        this.a.info(localize(1831, null, extensionsToUpdate.map((ext) => ext.extension.identifier.id).join(", ")));
        const installationResult = await this.b.installGalleryExtensions(extensionsToUpdate);
        for (const extensionResult of installationResult) {
          if (extensionResult.error) {
            this.a.error(localize(1832, null, extensionResult.identifier.id, $qb(extensionResult.error)));
          } else {
            this.a.info(localize(1833, null, extensionResult.identifier.id, extensionResult.local?.manifest.version));
          }
        }
      }
      async g(installExtensionInfos, installed, force) {
        installExtensionInfos = installExtensionInfos.filter(({ id: id2, version }) => {
          const installedExtension = installed.find((i) => $DA(i.identifier, { id: id2 }));
          if (installedExtension) {
            if (!force && (!version || version === "prerelease" && installedExtension.preRelease)) {
              this.a.info(localize(1834, null, id2, installedExtension.manifest.version, id2));
              return false;
            }
            if (version && installedExtension.manifest.version === version) {
              this.a.info(localize(1835, null, `${id2}@${version}`));
              return false;
            }
          }
          return true;
        });
        if (!installExtensionInfos.length) {
          return [];
        }
        const failed = [];
        const extensionsToInstall = [];
        const galleryExtensions = await this.j(installExtensionInfos);
        await Promise.all(installExtensionInfos.map(async ({ id: id2, version, installOptions }) => {
          const gallery = galleryExtensions.get(id2.toLowerCase());
          if (!gallery) {
            this.a.error(`${notFound(version ? `${id2}@${version}` : id2)}
${useId}`);
            failed.push(id2);
            return;
          }
          try {
            const manifest = await this.d.getManifest(gallery, CancellationToken.None);
            if (manifest && !this.k(manifest)) {
              return;
            }
          } catch (err) {
            this.a.error(err.message || err.stack || err);
            failed.push(id2);
            return;
          }
          const installedExtension = installed.find((e) => $DA(e.identifier, gallery.identifier));
          if (installedExtension) {
            if (gallery.version === installedExtension.manifest.version) {
              this.a.info(localize(1836, null, version ? `${id2}@${version}` : id2));
              return;
            }
            this.a.info(localize(1837, null, id2, gallery.version));
          }
          if (installOptions.isBuiltin) {
            this.a.info(version ? localize(1838, null, id2, version) : localize(1839, null, id2));
          } else {
            this.a.info(version ? localize(1840, null, id2, version) : localize(1841, null, id2));
          }
          extensionsToInstall.push({
            extension: gallery,
            options: { ...installOptions, installGivenVersion: !!version, isApplicationScoped: installOptions.isApplicationScoped || installedExtension?.isApplicationScoped }
          });
        }));
        if (extensionsToInstall.length) {
          const installationResult = await this.b.installGalleryExtensions(extensionsToInstall);
          for (const extensionResult of installationResult) {
            if (extensionResult.error) {
              this.a.error(localize(1842, null, extensionResult.identifier.id, $qb(extensionResult.error)));
              failed.push(extensionResult.identifier.id);
            } else {
              this.a.info(localize(1843, null, extensionResult.identifier.id, extensionResult.local?.manifest.version));
            }
          }
        }
        return failed;
      }
      async h(vsix, installOptions, force, installedExtensions) {
        const manifest = await this.b.getManifest(vsix);
        if (!manifest) {
          throw new Error("Invalid vsix");
        }
        const valid2 = await this.l(manifest, force, installOptions.profileLocation, installedExtensions);
        if (valid2) {
          try {
            await this.b.install(vsix, { ...installOptions, installGivenVersion: true });
            this.a.info(localize(1844, null, $sh(vsix)));
          } catch (error) {
            if ($kb(error)) {
              this.a.info(localize(1845, null, $sh(vsix)));
            } else {
              throw error;
            }
          }
        }
      }
      async j(extensions) {
        const galleryExtensions = /* @__PURE__ */ new Map();
        const preRelease = extensions.some((e) => e.installOptions.installPreReleaseVersion);
        const targetPlatform = await this.b.getTargetPlatform();
        const extensionInfos = [];
        for (const extension of extensions) {
          if ($dA.test(extension.id)) {
            extensionInfos.push({ ...extension, preRelease });
          }
        }
        if (extensionInfos.length) {
          const result = await this.d.getExtensions(extensionInfos, { targetPlatform }, CancellationToken.None);
          for (const extension of result) {
            galleryExtensions.set(extension.identifier.id.toLowerCase(), extension);
          }
        }
        return galleryExtensions;
      }
      k(_manifest) {
        return true;
      }
      async l(manifest, force, profileLocation, installedExtensions) {
        if (!force) {
          const extensionIdentifier = { id: $IA(manifest.publisher, manifest.name) };
          const newer = installedExtensions.find((local) => $DA(extensionIdentifier, local.identifier) && gt(local.manifest.version, manifest.version));
          if (newer) {
            this.a.info(localize(1846, null, newer.identifier.id, newer.manifest.version, manifest.version));
            return false;
          }
        }
        return this.k(manifest);
      }
      async uninstallExtensions(extensions, force, profileLocation) {
        const getId = async (extensionDescription) => {
          if (extensionDescription instanceof URI) {
            const manifest = await this.b.getManifest(extensionDescription);
            return $GA(manifest.publisher, manifest.name);
          }
          return extensionDescription;
        };
        const uninstalledExtensions = [];
        for (const extension of extensions) {
          const id2 = await getId(extension);
          const installed = await this.b.getInstalled(void 0, profileLocation);
          const extensionsToUninstall = installed.filter((e) => $DA(e.identifier, { id: id2 }));
          if (!extensionsToUninstall.length) {
            throw new Error(`${this.m(id2)}
${useId}`);
          }
          if (extensionsToUninstall.some(
            (e) => e.type === 0
            /* ExtensionType.System */
          )) {
            this.a.info(localize(1847, null, id2));
            return;
          }
          if (!force && extensionsToUninstall.some((e) => e.isBuiltin)) {
            this.a.info(localize(1848, null, id2));
            return;
          }
          this.a.info(localize(1849, null, id2));
          for (const extensionToUninstall of extensionsToUninstall) {
            await this.b.uninstall(extensionToUninstall, { profileLocation });
            uninstalledExtensions.push(extensionToUninstall);
          }
          if (this.f) {
            this.a.info(localize(1850, null, id2, this.f));
          } else {
            this.a.info(localize(1851, null, id2));
          }
        }
      }
      async locateExtension(extensions) {
        const installed = await this.b.getInstalled();
        extensions.forEach((e) => {
          installed.forEach((i) => {
            if (i.identifier.id === e) {
              if (i.location.scheme === Schemas.file) {
                this.a.info(i.location.fsPath);
                return;
              }
            }
          });
        });
      }
      m(id2) {
        return this.f ? localize(1852, null, id2, this.f) : localize(1853, null, id2);
      }
    };
    $bX = __decorate([
      __param(1, $sA),
      __param(2, $pA)
    ], $bX);
  }
});

// out-build/vs/platform/languagePacks/common/languagePacks.js
function $xX(extension) {
  return extension.tags.find((t) => t.startsWith("lp-"))?.split("lp-")[1];
}
var $yX, $zX;
var init_languagePacks = __esm({
  "out-build/vs/platform/languagePacks/common/languagePacks.js"() {
    "use strict";
    init_cancellation();
    init_lifecycle();
    init_platform();
    init_nls2();
    init_extensionManagement();
    init_instantiation();
    $yX = $Qk("languagePackService");
    $zX = class $zX2 extends $3c {
      constructor(c) {
        super();
        this.c = c;
      }
      async getAvailableLanguages() {
        const timeout = new $ad();
        setTimeout(() => timeout.cancel(), 1e3);
        let result;
        try {
          result = await this.c.query({
            text: 'category:"language packs"',
            pageSize: 20
          }, timeout.token);
        } catch (_) {
          return [];
        }
        const languagePackExtensions = result.firstPage.filter((e) => e.properties.localizedLanguages?.length && e.tags.some((t) => t.startsWith("lp-")));
        const allFromMarketplace = languagePackExtensions.map((lp) => {
          const languageName = lp.properties.localizedLanguages?.[0];
          const locale = $xX(lp);
          const baseQuickPick = this.f(locale, languageName, lp);
          return {
            ...baseQuickPick,
            extensionId: lp.identifier.id,
            galleryExtension: lp
          };
        });
        allFromMarketplace.push(this.f("en", "English"));
        return allFromMarketplace;
      }
      f(locale, languageName, languagePack) {
        const label = languageName ?? locale;
        let description;
        if (label !== locale) {
          description = `(${locale})`;
        }
        if (locale.toLowerCase() === $z.toLowerCase()) {
          description ??= "";
          description += localize(1961, null);
        }
        if (languagePack?.installCount) {
          description ??= "";
          const count = languagePack.installCount;
          let countLabel;
          if (count > 1e6) {
            countLabel = `${Math.floor(count / 1e5) / 10}M`;
          } else if (count > 1e3) {
            countLabel = `${Math.floor(count / 1e3)}K`;
          } else {
            countLabel = String(count);
          }
          description += ` $(cloud-download) ${countLabel}`;
        }
        return {
          id: locale,
          label,
          description
        };
      }
    };
    $zX = __decorate([
      __param(0, $pA)
    ], $zX);
  }
});

// out-build/vs/platform/languagePacks/node/languagePacks.js
import * as fs7 from "fs";
import { createHash } from "crypto";
function isValidLocalization(localization) {
  if (typeof localization.languageId !== "string") {
    return false;
  }
  if (!Array.isArray(localization.translations) || localization.translations.length === 0) {
    return false;
  }
  for (const translation of localization.translations) {
    if (typeof translation.id !== "string") {
      return false;
    }
    if (typeof translation.path !== "string") {
      return false;
    }
  }
  if (localization.languageName && typeof localization.languageName !== "string") {
    return false;
  }
  if (localization.localizedLanguageName && typeof localization.localizedLanguageName !== "string") {
    return false;
  }
  return true;
}
var $AX, LanguagePacksCache;
var init_languagePacks2 = __esm({
  "out-build/vs/platform/languagePacks/node/languagePacks.js"() {
    "use strict";
    init_arrays();
    init_async();
    init_lifecycle();
    init_network();
    init_path();
    init_pfs();
    init_environment();
    init_extensionManagement();
    init_extensionManagementUtil();
    init_log();
    init_languagePacks();
    init_uri();
    $AX = class $AX2 extends $zX {
      constructor(h, environmentService, extensionGalleryService, j) {
        super(extensionGalleryService);
        this.h = h;
        this.j = j;
        this.g = this.B(new LanguagePacksCache(environmentService, j));
        this.h.registerParticipant({
          postInstall: async (extension) => {
            return this.m(extension);
          },
          postUninstall: async (extension) => {
            return this.n(extension);
          }
        });
      }
      async getBuiltInExtensionTranslationsUri(id2, language) {
        const packs = await this.g.getLanguagePacks();
        const pack = packs[language];
        if (!pack) {
          this.j.warn(`No language pack found for ${language}`);
          return void 0;
        }
        const translation = pack.translations[id2];
        return translation ? URI.file(translation) : void 0;
      }
      async getInstalledLanguages() {
        const languagePacks = await this.g.getLanguagePacks();
        const languages = Object.keys(languagePacks).map((locale) => {
          const languagePack = languagePacks[locale];
          const baseQuickPick = this.f(locale, languagePack.label);
          return {
            ...baseQuickPick,
            extensionId: languagePack.extensions[0].extensionIdentifier.id
          };
        });
        languages.push(this.f("en", "English"));
        languages.sort((a, b) => a.label.localeCompare(b.label));
        return languages;
      }
      async m(extension) {
        if (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) {
          this.j.info("Adding language packs from the extension", extension.identifier.id);
          await this.update();
        }
      }
      async n(extension) {
        const languagePacks = await this.g.getLanguagePacks();
        if (Object.keys(languagePacks).some((language) => languagePacks[language] && languagePacks[language].extensions.some((e) => $DA(e.extensionIdentifier, extension.identifier)))) {
          this.j.info("Removing language packs from the extension", extension.identifier.id);
          await this.update();
        }
      }
      async update() {
        const [current, installed] = await Promise.all([this.g.getLanguagePacks(), this.h.getInstalled()]);
        const updated = await this.g.update(installed);
        return !$zb(Object.keys(current), Object.keys(updated));
      }
    };
    $AX = __decorate([
      __param(0, $sA),
      __param(1, $Yk),
      __param(2, $pA),
      __param(3, $wn)
    ], $AX);
    LanguagePacksCache = class LanguagePacksCache2 extends $3c {
      constructor(environmentService, j) {
        super();
        this.j = j;
        this.c = {};
        this.f = $nc(environmentService.userDataPath, "languagepacks.json");
        this.g = new $3h();
      }
      getLanguagePacks() {
        if (this.g.size || !this.h) {
          return this.s().then(() => this.c);
        }
        return Promise.resolve(this.c);
      }
      update(extensions) {
        return this.s((languagePacks) => {
          Object.keys(languagePacks).forEach((language) => delete languagePacks[language]);
          this.m(languagePacks, ...extensions);
        }).then(() => this.c);
      }
      m(languagePacks, ...extensions) {
        for (const extension of extensions) {
          if (extension && extension.manifest && extension.manifest.contributes && extension.manifest.contributes.localizations && extension.manifest.contributes.localizations.length) {
            this.n(languagePacks, extension);
          }
        }
        Object.keys(languagePacks).forEach((languageId) => this.r(languagePacks[languageId]));
      }
      n(languagePacks, extension) {
        const extensionIdentifier = extension.identifier;
        const localizations = extension.manifest.contributes && extension.manifest.contributes.localizations ? extension.manifest.contributes.localizations : [];
        for (const localizationContribution of localizations) {
          if (extension.location.scheme === Schemas.file && isValidLocalization(localizationContribution)) {
            let languagePack = languagePacks[localizationContribution.languageId];
            if (!languagePack) {
              languagePack = {
                hash: "",
                extensions: [],
                translations: {},
                label: localizationContribution.localizedLanguageName ?? localizationContribution.languageName
              };
              languagePacks[localizationContribution.languageId] = languagePack;
            }
            const extensionInLanguagePack = languagePack.extensions.filter((e) => $DA(e.extensionIdentifier, extensionIdentifier))[0];
            if (extensionInLanguagePack) {
              extensionInLanguagePack.version = extension.manifest.version;
            } else {
              languagePack.extensions.push({ extensionIdentifier, version: extension.manifest.version });
            }
            for (const translation of localizationContribution.translations) {
              languagePack.translations[translation.id] = $nc(extension.location.fsPath, translation.path);
            }
          }
        }
      }
      r(languagePack) {
        if (languagePack) {
          const md5 = createHash("md5");
          for (const extension of languagePack.extensions) {
            md5.update(extension.extensionIdentifier.uuid || extension.extensionIdentifier.id).update(extension.version);
          }
          languagePack.hash = md5.digest("hex");
        }
      }
      s(fn = () => null) {
        return this.g.queue(() => {
          let result = null;
          return fs7.promises.readFile(this.f, "utf8").then(void 0, (err) => err.code === "ENOENT" ? Promise.resolve("{}") : Promise.reject(err)).then((raw) => {
            try {
              return JSON.parse(raw);
            } catch (e) {
              return {};
            }
          }).then((languagePacks) => {
            result = fn(languagePacks);
            return languagePacks;
          }).then((languagePacks) => {
            for (const language of Object.keys(languagePacks)) {
              if (!languagePacks[language]) {
                delete languagePacks[language];
              }
            }
            this.c = languagePacks;
            this.h = true;
            const raw = JSON.stringify(this.c);
            this.j.debug("Writing language packs", raw);
            return Promises2.writeFile(this.f, raw);
          }).then(() => result, (error) => this.j.error(error));
        });
      }
    };
    LanguagePacksCache = __decorate([
      __param(0, $Yk),
      __param(1, $wn)
    ], LanguagePacksCache);
  }
});

// out-build/vs/platform/download/common/downloadService.js
var $eZ;
var init_downloadService = __esm({
  "out-build/vs/platform/download/common/downloadService.js"() {
    "use strict";
    init_cancellation();
    init_network();
    init_files();
    init_request();
    $eZ = class $eZ2 {
      constructor(a, b) {
        this.a = a;
        this.b = b;
      }
      async download(resource, target, cancellationToken = CancellationToken.None) {
        if (resource.scheme === Schemas.file || resource.scheme === Schemas.vscodeRemote) {
          await this.b.copy(resource, target);
          return;
        }
        const options2 = { type: "GET", url: resource.toString(true) };
        const context = await this.a.request(options2, cancellationToken);
        if (context.res.statusCode === 200) {
          await this.b.writeFile(target, context.stream);
        } else {
          const message = await $bv(context);
          throw new Error(`Expected 200, got back ${context.res.statusCode} instead.

${message}`);
        }
      }
    };
    $eZ = __decorate([
      __param(0, $9u),
      __param(1, $km)
    ], $eZ);
  }
});

// out-build/vs/platform/instantiation/common/extensions.js
function $SC(id2, ctorOrDescriptor, supportsDelayedInstantiation) {
  if (!(ctorOrDescriptor instanceof $Nk)) {
    ctorOrDescriptor = new $Nk(ctorOrDescriptor, [], Boolean(supportsDelayedInstantiation));
  }
  _registry.push([id2, ctorOrDescriptor]);
}
var _registry, InstantiationType;
var init_extensions2 = __esm({
  "out-build/vs/platform/instantiation/common/extensions.js"() {
    "use strict";
    init_descriptors();
    _registry = [];
    (function(InstantiationType2) {
      InstantiationType2[InstantiationType2["Eager"] = 0] = "Eager";
      InstantiationType2[InstantiationType2["Delayed"] = 1] = "Delayed";
    })(InstantiationType || (InstantiationType = {}));
  }
});

// out-build/vs/base/common/skipList.js
var _a3, Node2, NIL, $UC;
var init_skipList = __esm({
  "out-build/vs/base/common/skipList.js"() {
    "use strict";
    Node2 = class {
      constructor(level, key, value) {
        this.level = level;
        this.key = key;
        this.value = value;
        this.forward = [];
      }
    };
    NIL = void 0;
    $UC = class _$UC {
      /**
       *
       * @param capacity Capacity at which the list performs best
       */
      constructor(comparator, capacity = 2 ** 16) {
        this.comparator = comparator;
        this[_a3] = "SkipList";
        this.d = 0;
        this.f = 0;
        this.c = Math.max(1, Math.log2(capacity) | 0);
        this.e = new Node2(this.c, NIL, NIL);
      }
      get size() {
        return this.f;
      }
      clear() {
        this.e = new Node2(this.c, NIL, NIL);
        this.f = 0;
      }
      has(key) {
        return Boolean(_$UC.g(this, key, this.comparator));
      }
      get(key) {
        return _$UC.g(this, key, this.comparator)?.value;
      }
      set(key, value) {
        if (_$UC.h(this, key, value, this.comparator)) {
          this.f += 1;
        }
        return this;
      }
      delete(key) {
        const didDelete = _$UC.k(this, key, this.comparator);
        if (didDelete) {
          this.f -= 1;
        }
        return didDelete;
      }
      // --- iteration
      forEach(callbackfn, thisArg) {
        let node = this.e.forward[0];
        while (node) {
          callbackfn.call(thisArg, node.value, node.key, this);
          node = node.forward[0];
        }
      }
      [(_a3 = Symbol.toStringTag, Symbol.iterator)]() {
        return this.entries();
      }
      *entries() {
        let node = this.e.forward[0];
        while (node) {
          yield [node.key, node.value];
          node = node.forward[0];
        }
      }
      *keys() {
        let node = this.e.forward[0];
        while (node) {
          yield node.key;
          node = node.forward[0];
        }
      }
      *values() {
        let node = this.e.forward[0];
        while (node) {
          yield node.value;
          node = node.forward[0];
        }
      }
      toString() {
        let result = "[SkipList]:";
        let node = this.e.forward[0];
        while (node) {
          result += `node(${node.key}, ${node.value}, lvl:${node.level})`;
          node = node.forward[0];
        }
        return result;
      }
      // from https://www.epaperpress.com/sortsearch/download/skiplist.pdf
      static g(list2, searchKey, comparator) {
        let x = list2.e;
        for (let i = list2.d - 1; i >= 0; i--) {
          while (x.forward[i] && comparator(x.forward[i].key, searchKey) < 0) {
            x = x.forward[i];
          }
        }
        x = x.forward[0];
        if (x && comparator(x.key, searchKey) === 0) {
          return x;
        }
        return void 0;
      }
      static h(list2, searchKey, value, comparator) {
        const update = [];
        let x = list2.e;
        for (let i = list2.d - 1; i >= 0; i--) {
          while (x.forward[i] && comparator(x.forward[i].key, searchKey) < 0) {
            x = x.forward[i];
          }
          update[i] = x;
        }
        x = x.forward[0];
        if (x && comparator(x.key, searchKey) === 0) {
          x.value = value;
          return false;
        } else {
          const lvl = _$UC.j(list2);
          if (lvl > list2.d) {
            for (let i = list2.d; i < lvl; i++) {
              update[i] = list2.e;
            }
            list2.d = lvl;
          }
          x = new Node2(lvl, searchKey, value);
          for (let i = 0; i < lvl; i++) {
            x.forward[i] = update[i].forward[i];
            update[i].forward[i] = x;
          }
          return true;
        }
      }
      static j(list2, p = 0.5) {
        let lvl = 1;
        while (Math.random() < p && lvl < list2.c) {
          lvl += 1;
        }
        return lvl;
      }
      static k(list2, searchKey, comparator) {
        const update = [];
        let x = list2.e;
        for (let i = list2.d - 1; i >= 0; i--) {
          while (x.forward[i] && comparator(x.forward[i].key, searchKey) < 0) {
            x = x.forward[i];
          }
          update[i] = x;
        }
        x = x.forward[0];
        if (!x || comparator(x.key, searchKey) !== 0) {
          return false;
        }
        for (let i = 0; i < list2.d; i++) {
          if (update[i].forward[i] !== x) {
            break;
          }
          update[i].forward[i] = x.forward[i];
        }
        while (list2.d > 0 && list2.e.forward[list2.d - 1] === NIL) {
          list2.d -= 1;
        }
        return true;
      }
    };
  }
});

// out-build/vs/platform/uriIdentity/common/uriIdentityService.js
var Entry, $VC;
var init_uriIdentityService = __esm({
  "out-build/vs/platform/uriIdentity/common/uriIdentityService.js"() {
    "use strict";
    init_uriIdentity();
    init_extensions2();
    init_files();
    init_resources();
    init_skipList();
    init_event();
    init_lifecycle();
    Entry = class _Entry {
      static {
        this._clock = 0;
      }
      constructor(uri) {
        this.uri = uri;
        this.time = _Entry._clock++;
      }
      touch() {
        this.time = _Entry._clock++;
        return this;
      }
    };
    $VC = class $VC2 {
      constructor(g) {
        this.g = g;
        this.c = new $2c();
        this.f = 2 ** 16;
        const schemeIgnoresPathCasingCache = /* @__PURE__ */ new Map();
        const ignorePathCasing = (uri) => {
          let ignorePathCasing2 = schemeIgnoresPathCasingCache.get(uri.scheme);
          if (ignorePathCasing2 === void 0) {
            ignorePathCasing2 = g.hasProvider(uri) && !this.g.hasCapability(
              uri,
              1024
              /* FileSystemProviderCapabilities.PathCaseSensitive */
            );
            schemeIgnoresPathCasingCache.set(uri.scheme, ignorePathCasing2);
          }
          return ignorePathCasing2;
        };
        this.c.add(Event.any(g.onDidChangeFileSystemProviderRegistrations, g.onDidChangeFileSystemProviderCapabilities)((e) => {
          schemeIgnoresPathCasingCache.delete(e.scheme);
        }));
        this.extUri = new $kh(ignorePathCasing);
        this.d = new $UC((a, b) => this.extUri.compare(a, b, true), this.f);
      }
      dispose() {
        this.c.dispose();
        this.d.clear();
      }
      asCanonicalUri(uri) {
        if (this.g.hasProvider(uri)) {
          uri = $wh(uri);
        }
        const item = this.d.get(uri);
        if (item) {
          return item.touch().uri.with({ fragment: uri.fragment });
        }
        this.d.set(uri, new Entry(uri));
        this.h();
        return uri;
      }
      h() {
        if (this.d.size < this.f) {
          return;
        }
        const entries = [...this.d.entries()].sort((a, b) => {
          if (a[1].time < b[1].time) {
            return 1;
          } else if (a[1].time > b[1].time) {
            return -1;
          } else {
            return 0;
          }
        });
        Entry._clock = 0;
        this.d.clear();
        const newSize = this.f * 0.5;
        for (let i = 0; i < newSize; i++) {
          this.d.set(entries[i][0], entries[i][1].touch());
        }
      }
    };
    $VC = __decorate([
      __param(0, $km)
    ], $VC);
    $SC(
      $vl,
      $VC,
      1
      /* InstantiationType.Delayed */
    );
  }
});

// out-build/vs/server/node/remoteLanguagePacks.js
async function $NW(language, userDataPath) {
  if (!product_default.commit || !await Promises2.exists(defaultMessagesFile)) {
    return {
      userLocale: "en",
      osLocale: "en",
      resolvedLanguage: "en",
      defaultMessagesFile,
      // NLS: below 2 are a relic from old times only used by vscode-nls and deprecated
      locale: "en",
      availableLanguages: {}
    };
  }
  const cacheKey = `${language}||${userDataPath}`;
  let result = nlsConfigurationCache.get(cacheKey);
  if (!result) {
    result = $Os({ userLocale: language, osLocale: language, commit: product_default.commit, userDataPath, nlsMetadataPath });
    nlsConfigurationCache.set(cacheKey, result);
  }
  return result;
}
var nlsMetadataPath, defaultMessagesFile, nlsConfigurationCache;
var init_remoteLanguagePacks = __esm({
  "out-build/vs/server/node/remoteLanguagePacks.js"() {
    "use strict";
    init_network();
    init_path();
    init_nls();
    init_pfs();
    init_product();
    nlsMetadataPath = $nc($ih.asFileUri("").fsPath);
    defaultMessagesFile = $nc(nlsMetadataPath, "nls.messages.json");
    nlsConfigurationCache = /* @__PURE__ */ new Map();
  }
});

// out-build/vs/server/node/extensionsScannerService.js
var $JY;
var init_extensionsScannerService2 = __esm({
  "out-build/vs/server/node/extensionsScannerService.js"() {
    "use strict";
    init_resources();
    init_uri();
    init_environment();
    init_extensionsProfileScannerService();
    init_extensionsScannerService();
    init_files();
    init_instantiation();
    init_log();
    init_productService();
    init_uriIdentity();
    init_userDataProfile();
    init_remoteLanguagePacks();
    $JY = class $JY2 extends $5A {
      constructor(userDataProfilesService, extensionsProfileScannerService, fileService, logService, S, productService, uriIdentityService, instantiationService) {
        super(URI.file(S.builtinExtensionsPath), URI.file(S.extensionsPath), $vh(S.userHome, ".vscode-oss-dev", "extensions", "control.json"), userDataProfilesService.defaultProfile, userDataProfilesService, extensionsProfileScannerService, fileService, logService, S, productService, uriIdentityService, instantiationService);
        this.S = S;
      }
      async f(language) {
        const config = await $NW(language, this.S.userDataPath);
        if (config.languagePack) {
          try {
            const content = await this.w.readFile(URI.file(config.languagePack.translationsConfigFile));
            return JSON.parse(content.value.toString());
          } catch (err) {
          }
        }
        return /* @__PURE__ */ Object.create(null);
      }
    };
    $JY = __decorate([
      __param(0, $rs),
      __param(1, $QA),
      __param(2, $km),
      __param(3, $wn),
      __param(4, $Yk),
      __param(5, $Vu),
      __param(6, $vl),
      __param(7, $Pk)
    ], $JY);
  }
});

// out-build/vs/platform/state/node/state.js
var $pv, $qv;
var init_state = __esm({
  "out-build/vs/platform/state/node/state.js"() {
    "use strict";
    init_instantiation();
    $pv = $Qk("stateReadService");
    $qv = $Qk("stateService");
  }
});

// out-build/vs/platform/state/node/stateService.js
var SaveStrategy, $Hw, $Iw, $Jw;
var init_stateService = __esm({
  "out-build/vs/platform/state/node/stateService.js"() {
    "use strict";
    init_async();
    init_buffer();
    init_lifecycle();
    init_types();
    init_environment();
    init_files();
    init_log();
    (function(SaveStrategy2) {
      SaveStrategy2[SaveStrategy2["IMMEDIATE"] = 0] = "IMMEDIATE";
      SaveStrategy2[SaveStrategy2["DELAYED"] = 1] = "DELAYED";
    })(SaveStrategy || (SaveStrategy = {}));
    $Hw = class extends $3c {
      constructor(h, j, m, n) {
        super();
        this.h = h;
        this.j = j;
        this.m = m;
        this.n = n;
        this.a = /* @__PURE__ */ Object.create(null);
        this.b = "";
        this.c = this.B(new $Th(
          this.j === 0 ? 0 : 100
          /* buffer saves over a short time */
        ));
        this.f = void 0;
        this.g = void 0;
      }
      init() {
        if (!this.f) {
          this.f = this.r();
        }
        return this.f;
      }
      async r() {
        try {
          this.b = (await this.n.readFile(this.h)).value.toString();
          this.a = JSON.parse(this.b);
        } catch (error) {
          if (error.fileOperationResult !== 1) {
            this.m.error(error);
          }
        }
      }
      getItem(key, defaultValue) {
        const res = this.a[key];
        if ($Ig(res)) {
          return defaultValue;
        }
        return res;
      }
      setItem(key, data) {
        this.setItems([{ key, data }]);
      }
      setItems(items) {
        let save = false;
        for (const { key, data } of items) {
          if (this.a[key] === data) {
            continue;
          }
          if ($Ig(data)) {
            if (!$Gg(this.a[key])) {
              this.a[key] = void 0;
              save = true;
            }
          } else {
            this.a[key] = data;
            save = true;
          }
        }
        if (save) {
          this.s();
        }
      }
      removeItem(key) {
        if (!$Gg(this.a[key])) {
          this.a[key] = void 0;
          this.s();
        }
      }
      async s() {
        if (this.g) {
          return;
        }
        return this.c.trigger(() => this.t());
      }
      async t() {
        if (!this.f) {
          return;
        }
        await this.f;
        const serializedDatabase = JSON.stringify(this.a, null, 4);
        if (serializedDatabase === this.b) {
          return;
        }
        try {
          await this.n.writeFile(this.h, $Ci.fromString(serializedDatabase), { atomic: { postfix: ".vsctmp" } });
          this.b = serializedDatabase;
        } catch (error) {
          this.m.error(error);
        }
      }
      async close() {
        if (!this.g) {
          this.g = this.c.trigger(
            () => this.t(),
            0
            /* as soon as possible */
          );
        }
        return this.g;
      }
    };
    $Iw = class $Iw2 extends $3c {
      constructor(saveStrategy, environmentService, logService, fileService) {
        super();
        this.a = this.B(new $Hw(environmentService.stateResource, saveStrategy, logService, fileService));
      }
      async init() {
        await this.a.init();
      }
      getItem(key, defaultValue) {
        return this.a.getItem(key, defaultValue);
      }
    };
    $Iw = __decorate([
      __param(1, $Xk),
      __param(2, $wn),
      __param(3, $km)
    ], $Iw);
    $Jw = class extends $Iw {
      setItem(key, data) {
        this.a.setItem(key, data);
      }
      setItems(items) {
        this.a.setItems(items);
      }
      removeItem(key) {
        this.a.removeItem(key);
      }
      close() {
        return this.a.close();
      }
    };
  }
});

// out-build/vs/platform/userDataProfile/node/userDataProfile.js
var $Kw_1, $Lw_1, $Kw, $Lw, $Mw;
var init_userDataProfile2 = __esm({
  "out-build/vs/platform/userDataProfile/node/userDataProfile.js"() {
    "use strict";
    init_uri();
    init_environment();
    init_files();
    init_log();
    init_state();
    init_uriIdentity();
    init_userDataProfile();
    init_types();
    init_stateService();
    $Kw = $Kw_1 = class $Kw2 extends $us {
      constructor(a, uriIdentityService, S, fileService, logService) {
        super(S, fileService, uriIdentityService, logService);
        this.a = a;
        this.S = S;
      }
      N() {
        const storedProfilesState = this.a.getItem($Kw_1.b, []);
        return storedProfilesState.map((p) => ({ ...p, location: $zg(p.location) ? this.u.extUri.joinPath(this.profilesHome, p.location) : URI.revive(p.location) }));
      }
      P() {
        return this.a.getItem($Kw_1.c, {});
      }
      R() {
        return this.u.extUri.joinPath(URI.file(this.S.extensionsPath).with({ scheme: this.profilesHome.scheme }), "extensions.json");
      }
    };
    $Kw = $Kw_1 = __decorate([
      __param(0, $pv),
      __param(1, $vl),
      __param(2, $Yk),
      __param(3, $km),
      __param(4, $wn)
    ], $Kw);
    $Lw = $Lw_1 = class $Lw2 extends $Kw {
      constructor(Y, uriIdentityService, environmentService, fileService, logService) {
        super(Y, uriIdentityService, environmentService, fileService, logService);
        this.Y = Y;
      }
      O(storedProfiles) {
        if (storedProfiles.length) {
          this.Y.setItem($Lw_1.b, storedProfiles.map((profile) => ({ ...profile, location: this.u.extUri.basename(profile.location) })));
        } else {
          this.Y.removeItem($Lw_1.b);
        }
      }
      Q(storedProfileAssociations) {
        if (storedProfileAssociations.emptyWindows || storedProfileAssociations.workspaces) {
          this.Y.setItem($Lw_1.c, storedProfileAssociations);
        } else {
          this.Y.removeItem($Lw_1.c);
        }
      }
    };
    $Lw = $Lw_1 = __decorate([
      __param(0, $qv),
      __param(1, $vl),
      __param(2, $Yk),
      __param(3, $km),
      __param(4, $wn)
    ], $Lw);
    $Mw = class $Mw2 extends $Lw {
      constructor(uriIdentityService, environmentService, fileService, logService) {
        super(new $Jw(0, environmentService, logService, fileService), uriIdentityService, environmentService, fileService, logService);
      }
      async init() {
        await this.Y.init();
        return super.init();
      }
    };
    $Mw = __decorate([
      __param(0, $vl),
      __param(1, $Yk),
      __param(2, $km),
      __param(3, $wn)
    ], $Mw);
  }
});

// out-build/vs/platform/extensionManagement/node/extensionsProfileScannerService.js
var $jB;
var init_extensionsProfileScannerService2 = __esm({
  "out-build/vs/platform/extensionManagement/node/extensionsProfileScannerService.js"() {
    "use strict";
    init_log();
    init_userDataProfile();
    init_uriIdentity();
    init_telemetry();
    init_extensionsProfileScannerService();
    init_files();
    init_environment();
    init_uri();
    $jB = class $jB2 extends $RA {
      constructor(environmentService, fileService, userDataProfilesService, uriIdentityService, telemetryService, logService) {
        super(URI.file(environmentService.extensionsPath), fileService, userDataProfilesService, uriIdentityService, telemetryService, logService);
      }
    };
    $jB = __decorate([
      __param(0, $Yk),
      __param(1, $km),
      __param(2, $rs),
      __param(3, $vl),
      __param(4, $zv),
      __param(5, $wn)
    ], $jB);
  }
});

// out-build/vs/platform/log/common/logService.js
var $WC;
var init_logService = __esm({
  "out-build/vs/platform/log/common/logService.js"() {
    "use strict";
    init_lifecycle();
    init_log();
    $WC = class extends $3c {
      constructor(primaryLogger, otherLoggers = []) {
        super();
        this.a = new $Gn([primaryLogger, ...otherLoggers]);
        this.B(primaryLogger.onDidChangeLogLevel((level) => this.setLevel(level)));
      }
      get onDidChangeLogLevel() {
        return this.a.onDidChangeLogLevel;
      }
      setLevel(level) {
        this.a.setLevel(level);
      }
      getLevel() {
        return this.a.getLevel();
      }
      trace(message, ...args) {
        this.a.trace(message, ...args);
      }
      debug(message, ...args) {
        this.a.debug(message, ...args);
      }
      info(message, ...args) {
        this.a.info(message, ...args);
      }
      warn(message, ...args) {
        this.a.warn(message, ...args);
      }
      error(message, ...args) {
        this.a.error(message, ...args);
      }
      flush() {
        this.a.flush();
      }
    };
  }
});

// out-build/vs/platform/log/node/spdlogLog.js
async function createSpdLogLogger(name, logfilePath, filesize, filecount, donotUseFormatters) {
  try {
    const _spdlog = await import("@vscode/spdlog");
    _spdlog.setFlushOn(SpdLogLevel.Trace);
    const logger = await _spdlog.createAsyncRotatingLogger(name, logfilePath, filesize, filecount);
    if (donotUseFormatters) {
      logger.clearFormatters();
    } else {
      logger.setPattern("%Y-%m-%d %H:%M:%S.%e [%l] %v");
    }
    return logger;
  } catch (e) {
    console.error(e);
  }
  return null;
}
function log3(logger, level, message) {
  switch (level) {
    case LogLevel.Trace:
      logger.trace(message);
      break;
    case LogLevel.Debug:
      logger.debug(message);
      break;
    case LogLevel.Info:
      logger.info(message);
      break;
    case LogLevel.Warning:
      logger.warn(message);
      break;
    case LogLevel.Error:
      logger.error(message);
      break;
    case LogLevel.Off:
      break;
    default:
      throw new Error(`Invalid log level ${level}`);
  }
}
function setLogLevel(logger, level) {
  switch (level) {
    case LogLevel.Trace:
      logger.setLevel(SpdLogLevel.Trace);
      break;
    case LogLevel.Debug:
      logger.setLevel(SpdLogLevel.Debug);
      break;
    case LogLevel.Info:
      logger.setLevel(SpdLogLevel.Info);
      break;
    case LogLevel.Warning:
      logger.setLevel(SpdLogLevel.Warning);
      break;
    case LogLevel.Error:
      logger.setLevel(SpdLogLevel.Error);
      break;
    case LogLevel.Off:
      logger.setLevel(SpdLogLevel.Off);
      break;
    default:
      throw new Error(`Invalid log level ${level}`);
  }
}
var SpdLogLevel, $fx;
var init_spdlogLog = __esm({
  "out-build/vs/platform/log/node/spdlogLog.js"() {
    "use strict";
    init_files();
    init_log();
    (function(SpdLogLevel2) {
      SpdLogLevel2[SpdLogLevel2["Trace"] = 0] = "Trace";
      SpdLogLevel2[SpdLogLevel2["Debug"] = 1] = "Debug";
      SpdLogLevel2[SpdLogLevel2["Info"] = 2] = "Info";
      SpdLogLevel2[SpdLogLevel2["Warning"] = 3] = "Warning";
      SpdLogLevel2[SpdLogLevel2["Error"] = 4] = "Error";
      SpdLogLevel2[SpdLogLevel2["Critical"] = 5] = "Critical";
      SpdLogLevel2[SpdLogLevel2["Off"] = 6] = "Off";
    })(SpdLogLevel || (SpdLogLevel = {}));
    $fx = class extends $Cn {
      constructor(name, filepath, rotating, donotUseFormatters, level) {
        super();
        this.n = [];
        this.setLevel(level);
        this.r = this.t(name, filepath, rotating, donotUseFormatters);
        this.B(this.onDidChangeLogLevel((level2) => {
          if (this.s) {
            setLogLevel(this.s, level2);
          }
        }));
      }
      async t(name, filepath, rotating, donotUseFormatters) {
        const filecount = rotating ? 6 : 1;
        const filesize = 30 / filecount * $Sm.MB;
        const logger = await createSpdLogLogger(name, filepath, filesize, filecount, donotUseFormatters);
        if (logger) {
          this.s = logger;
          setLogLevel(this.s, this.getLevel());
          for (const { level, message } of this.n) {
            log3(this.s, level, message);
          }
          this.n = [];
        }
      }
      m(level, message) {
        if (this.s) {
          log3(this.s, level, message);
        } else if (this.getLevel() <= level) {
          this.n.push({ level, message });
        }
      }
      flush() {
        if (this.s) {
          this.w();
        } else {
          this.r.then(() => this.w());
        }
      }
      dispose() {
        if (this.s) {
          this.y();
        } else {
          this.r.then(() => this.y());
        }
        super.dispose();
      }
      w() {
        if (this.s) {
          this.s.flush();
        }
      }
      y() {
        if (this.s) {
          this.s.drop();
          this.s = void 0;
        }
      }
    };
  }
});

// out-build/vs/platform/log/node/loggerService.js
var $gx;
var init_loggerService = __esm({
  "out-build/vs/platform/log/node/loggerService.js"() {
    "use strict";
    init_uuid();
    init_log();
    init_spdlogLog();
    $gx = class extends $Hn {
      s(resource, logLevel, options2) {
        return new $fx($ps(), resource.fsPath, !options2?.donotRotate, !!options2?.donotUseFormatters, logLevel);
      }
    };
  }
});

// out-build/vs/base/node/unc.js
function processUNCHostAllowlist() {
  return process.uncHostAllowlist;
}
function $zt(allowedHost) {
  if (process.platform !== "win32") {
    return;
  }
  const allowlist = processUNCHostAllowlist();
  if (allowlist) {
    if (typeof allowedHost === "string") {
      allowlist.add(allowedHost.toLowerCase());
    } else {
      for (const host of toSafeStringArray(allowedHost)) {
        $zt(host);
      }
    }
  }
}
function toSafeStringArray(arg0) {
  const allowedUNCHosts = /* @__PURE__ */ new Set();
  if (Array.isArray(arg0)) {
    for (const host of arg0) {
      if (typeof host === "string") {
        allowedUNCHosts.add(host);
      }
    }
  }
  return Array.from(allowedUNCHosts);
}
function $Bt() {
  if (process.platform !== "win32") {
    return;
  }
  process.restrictUNCAccess = false;
}
var init_unc = __esm({
  "out-build/vs/base/node/unc.js"() {
    "use strict";
  }
});

// out-build/vs/platform/extensionManagement/common/allowedExtensionsService.js
function isGalleryExtension(extension) {
  return extension.type === "gallery";
}
function isIExtension(extension) {
  return extension.type === 1 || extension.type === 0;
}
var VersionRegex, $UY;
var init_allowedExtensionsService = __esm({
  "out-build/vs/platform/extensionManagement/common/allowedExtensionsService.js"() {
    "use strict";
    init_lifecycle();
    init_uri();
    init_nls2();
    init_extensionManagement();
    init_productService();
    init_htmlContent();
    init_configuration();
    init_types();
    init_event();
    VersionRegex = /^(?<version>\d+\.\d+\.\d+(-.*)?)(@(?<platform>.+))?$/;
    $UY = class $UY2 extends $3c {
      constructor(productService, f) {
        super();
        this.f = f;
        this.c = this.B(new $ze());
        this.onDidChangeAllowedExtensions = this.c.event;
        this.b = productService.extensionPublisherOrgs?.map((p) => p.toLowerCase()) ?? [];
        this.a = this.g();
        this.B(this.f.onDidChangeConfiguration((e) => {
          if (e.affectsConfiguration($CA)) {
            this.a = this.g();
            this.c.fire();
          }
        }));
      }
      g() {
        const value = this.f.getValue($CA);
        if (!$Bg(value) || Array.isArray(value)) {
          return void 0;
        }
        const entries = Object.entries(value).map(([key, value2]) => [key.toLowerCase(), value2]);
        if (entries.length === 1 && entries[0][0] === "*" && entries[0][1] === true) {
          return void 0;
        }
        return Object.fromEntries(entries);
      }
      isAllowed(extension) {
        if (!this.a) {
          return true;
        }
        let id2, version, targetPlatform, prerelease2, publisher, publisherDisplayName;
        if (isGalleryExtension(extension)) {
          id2 = extension.identifier.id.toLowerCase();
          version = extension.version;
          prerelease2 = extension.properties.isPreReleaseVersion;
          publisher = extension.publisher.toLowerCase();
          publisherDisplayName = extension.publisherDisplayName.toLowerCase();
          targetPlatform = extension.properties.targetPlatform;
        } else if (isIExtension(extension)) {
          id2 = extension.identifier.id.toLowerCase();
          version = extension.manifest.version;
          prerelease2 = extension.preRelease;
          publisher = extension.manifest.publisher.toLowerCase();
          publisherDisplayName = extension.publisherDisplayName?.toLowerCase();
          targetPlatform = extension.targetPlatform;
        } else {
          id2 = extension.id.toLowerCase();
          version = extension.version ?? "*";
          targetPlatform = extension.targetPlatform ?? "universal";
          prerelease2 = extension.prerelease ?? false;
          publisher = extension.id.substring(0, extension.id.indexOf(".")).toLowerCase();
          publisherDisplayName = extension.publisherDisplayName?.toLowerCase();
        }
        const settingsCommandLink = URI.parse(`command:workbench.action.openSettings?${encodeURIComponent(JSON.stringify({ query: `@id:${$CA}` }))}`).toString();
        const extensionValue = this.a[id2];
        const extensionReason = new $bm(localize(1815, null, settingsCommandLink));
        if (!$Gg(extensionValue)) {
          if ($Fg(extensionValue)) {
            return extensionValue ? true : extensionReason;
          }
          if (extensionValue === "stable" && prerelease2) {
            return new $bm(localize(1816, null, settingsCommandLink));
          }
          if (version !== "*" && Array.isArray(extensionValue) && !extensionValue.some((v) => {
            const match = VersionRegex.exec(v);
            if (match && match.groups) {
              const { platform: p, version: v2 } = match.groups;
              if (v2 !== version) {
                return false;
              }
              if (targetPlatform !== "universal" && p && targetPlatform !== p) {
                return false;
              }
              return true;
            }
            return false;
          })) {
            return new $bm(localize(1817, null, version, settingsCommandLink));
          }
          return true;
        }
        const publisherKey = publisherDisplayName && this.b.includes(publisherDisplayName) ? publisherDisplayName : publisher;
        const publisherValue = this.a[publisherKey];
        if (!$Gg(publisherValue)) {
          if ($Fg(publisherValue)) {
            return publisherValue ? true : new $bm(localize(1818, null, publisherKey, settingsCommandLink));
          }
          if (publisherValue === "stable" && prerelease2) {
            return new $bm(localize(1819, null, publisherKey, settingsCommandLink));
          }
          return true;
        }
        if (this.a["*"] === true) {
          return true;
        }
        return extensionReason;
      }
    };
    $UY = __decorate([
      __param(0, $Vu),
      __param(1, $kl)
    ], $UY);
  }
});

// out-build/vs/server/node/remoteExtensionHostAgentCli.js
function eventuallyExit(code) {
  setTimeout(() => process.exit(code), 0);
}
async function run(args, REMOTE_DATA_FOLDER, optionDescriptions) {
  if (args.help) {
    const executable = product_default.serverApplicationName + ($l ? ".cmd" : "");
    console.log($lt(product_default.nameLong, executable, product_default.version, optionDescriptions, { noInputFiles: true, noPipe: true }));
    return;
  }
  if (args.version) {
    console.log($mt(product_default.version, product_default.commit));
    return;
  }
  const cliMain = new CliMain(args, REMOTE_DATA_FOLDER);
  try {
    await cliMain.run();
    eventuallyExit(0);
  } catch (err) {
    eventuallyExit(1);
  } finally {
    cliMain.dispose();
  }
}
var CliMain;
var init_remoteExtensionHostAgentCli = __esm({
  "out-build/vs/server/node/remoteExtensionHostAgentCli.js"() {
    "use strict";
    init_serviceCollection();
    init_log();
    init_descriptors();
    init_configurationService();
    init_configuration();
    init_request();
    init_requestService();
    init_telemetryUtils();
    init_telemetry();
    init_extensionManagement();
    init_extensionGalleryService();
    init_extensionManagementService();
    init_extensionSignatureVerificationService();
    init_instantiationService();
    init_product();
    init_lifecycle();
    init_fileService();
    init_diskFileSystemProvider2();
    init_network();
    init_files();
    init_productService();
    init_serverEnvironmentService();
    init_extensionManagementCLI();
    init_languagePacks();
    init_languagePacks2();
    init_errors();
    init_uri();
    init_path();
    init_process();
    init_downloadService();
    init_download();
    init_uriIdentity();
    init_uriIdentityService();
    init_argv();
    init_platform();
    init_extensionsScannerService();
    init_extensionsScannerService2();
    init_userDataProfile();
    init_extensionsProfileScannerService();
    init_policy();
    init_userDataProfile2();
    init_extensionsProfileScannerService2();
    init_logService();
    init_loggerService();
    init_nls2();
    init_unc();
    init_allowedExtensionsService();
    CliMain = class extends $3c {
      constructor(a, b) {
        super();
        this.a = a;
        this.b = b;
        this.c();
      }
      c() {
        process.once("exit", () => this.dispose());
      }
      async run() {
        const instantiationService = await this.f();
        await instantiationService.invokeFunction(async (accessor) => {
          const configurationService = accessor.get($kl);
          const logService = accessor.get($wn);
          if ($l) {
            if (configurationService.getValue("security.restrictUNCAccess") === false) {
              $Bt();
            } else {
              $zt(configurationService.getValue("security.allowedUNCHosts"));
            }
          }
          try {
            await this.g(instantiationService.createInstance($bX, new $En(logService.getLevel(), false)));
          } catch (error) {
            logService.error(error);
            console.error($qb(error));
            throw error;
          }
        });
      }
      async f() {
        const services = new $Ok();
        const productService = { _serviceBrand: void 0, ...product_default };
        services.set($Vu, productService);
        const environmentService = new $QW(this.a, productService);
        services.set($PW, environmentService);
        const loggerService = new $gx($Kn(environmentService), environmentService.logsHome);
        services.set($xn, loggerService);
        const logService = new $WC(this.B(loggerService.createLogger("remoteCLI", { name: localize(2550, null) })));
        services.set($wn, logService);
        logService.trace(`Remote configuration data at ${this.b}`);
        logService.trace("process arguments:", this.a);
        const fileService = this.B(new $7B(logService));
        services.set($km, fileService);
        fileService.registerProvider(Schemas.file, this.B(new $qy(logService)));
        const uriIdentityService = new $VC(fileService);
        services.set($vl, uriIdentityService);
        const userDataProfilesService = this.B(new $Mw(uriIdentityService, environmentService, fileService, logService));
        services.set($rs, userDataProfilesService);
        const configurationService = this.B(new $2B(userDataProfilesService.defaultProfile.settingsResource, fileService, new $Rn(), logService));
        services.set($kl, configurationService);
        await Promise.all([
          configurationService.initialize(),
          userDataProfilesService.init()
        ]);
        services.set($9u, new $Nk($KC));
        services.set($6W, new $Nk($eZ));
        services.set($zv, $dw);
        services.set($pA, new $Nk($$W));
        services.set($QA, new $Nk($jB));
        services.set($4A, new $Nk($JY));
        services.set($_W, new $Nk($aX));
        services.set($xA, new $Nk($UY));
        services.set($uX, new $Nk($vX));
        services.set($yX, new $Nk($AX));
        return new $0B(services);
      }
      async g(extensionManagementCLI) {
        if (this.a["list-extensions"]) {
          return extensionManagementCLI.listExtensions(!!this.a["show-versions"], this.a["category"]);
        } else if (this.a["install-extension"] || this.a["install-builtin-extension"]) {
          const installOptions = { isMachineScoped: !!this.a["do-not-sync"], installPreReleaseVersion: !!this.a["pre-release"] };
          return extensionManagementCLI.installExtensions(this.h(this.a["install-extension"] || []), this.h(this.a["install-builtin-extension"] || []), installOptions, !!this.a["force"]);
        } else if (this.a["uninstall-extension"]) {
          return extensionManagementCLI.uninstallExtensions(this.h(this.a["uninstall-extension"]), !!this.a["force"]);
        } else if (this.a["update-extensions"]) {
          return extensionManagementCLI.updateExtensions();
        } else if (this.a["locate-extension"]) {
          return extensionManagementCLI.locateExtension(this.a["locate-extension"]);
        }
      }
      h(inputs) {
        return inputs.map((input) => /\.vsix$/i.test(input) ? URI.file($mc(input) ? input : $nc(cwd(), input)) : input);
      }
    };
  }
});

// out-build/vs/base/node/osReleaseInfo.js
import { constants as FSConstants, promises as FSPromises } from "fs";
import { createInterface as readLines } from "readline";
async function $KW(errorLogger) {
  if ($m || $l) {
    return;
  }
  let handle;
  for (const filePath of ["/etc/os-release", "/usr/lib/os-release", "/etc/lsb-release"]) {
    try {
      handle = await FSPromises.open(filePath, FSConstants.R_OK);
      break;
    } catch (err) {
    }
  }
  if (!handle) {
    errorLogger("Unable to retrieve release information from known identifier paths.");
    return;
  }
  try {
    const osReleaseKeys = /* @__PURE__ */ new Set([
      "ID",
      "DISTRIB_ID",
      "ID_LIKE",
      "VERSION_ID",
      "DISTRIB_RELEASE"
    ]);
    const releaseInfo = {
      id: "unknown"
    };
    for await (const line of readLines({ input: handle.createReadStream(), crlfDelay: Infinity })) {
      if (!line.includes("=")) {
        continue;
      }
      const key = line.split("=")[0].toUpperCase().trim();
      if (osReleaseKeys.has(key)) {
        const value = line.split("=")[1].replace(/"/g, "").toLowerCase().trim();
        if (key === "ID" || key === "DISTRIB_ID") {
          releaseInfo.id = value;
        } else if (key === "ID_LIKE") {
          releaseInfo.id_like = value;
        } else if (key === "VERSION_ID" || key === "DISTRIB_RELEASE") {
          releaseInfo.version_id = value;
        }
      }
    }
    return releaseInfo;
  } catch (err) {
    errorLogger(err);
  }
  return;
}
var init_osReleaseInfo = __esm({
  "out-build/vs/base/node/osReleaseInfo.js"() {
    "use strict";
    init_platform();
  }
});

// out-build/vs/base/node/ports.js
import * as net from "net";
function $Zs(startPort, giveUpAfter, timeout, stride = 1) {
  let done = false;
  return new Promise((resolve4) => {
    const timeoutHandle = setTimeout(() => {
      if (!done) {
        done = true;
        return resolve4(0);
      }
    }, timeout);
    doFindFreePort(startPort, giveUpAfter, stride, (port) => {
      if (!done) {
        done = true;
        clearTimeout(timeoutHandle);
        return resolve4(port);
      }
    });
  });
}
function doFindFreePort(startPort, giveUpAfter, stride, clb) {
  if (giveUpAfter === 0) {
    return clb(0);
  }
  const client = new net.Socket();
  client.once("connect", () => {
    dispose(client);
    return doFindFreePort(startPort + stride, giveUpAfter - 1, stride, clb);
  });
  client.once("data", () => {
  });
  client.once("error", (err) => {
    dispose(client);
    if (err.code !== "ECONNREFUSED") {
      return doFindFreePort(startPort + stride, giveUpAfter - 1, stride, clb);
    }
    return clb(startPort);
  });
  client.connect(startPort, "127.0.0.1");
}
function dispose(socket) {
  try {
    socket.removeAllListeners("connect");
    socket.removeAllListeners("error");
    socket.end();
    socket.destroy();
    socket.unref();
  } catch (error) {
    console.error(error);
  }
}
var init_ports = __esm({
  "out-build/vs/base/node/ports.js"() {
    "use strict";
  }
});

// out-build/vs/base/parts/ipc/common/ipc.net.js
function getEmptyBuffer() {
  if (!emptyBuffer) {
    emptyBuffer = $Ci.alloc(0);
  }
  return emptyBuffer;
}
function protocolMessageTypeToString(messageType) {
  switch (messageType) {
    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 SocketDiagnosticsEventType, SocketDiagnostics, SocketCloseEventType, emptyBuffer, $pu, ProtocolMessageType, ProtocolConstants, ProtocolMessage, ProtocolReader, ProtocolWriter, $su, QueueElement, Queue, LoadEstimator, $tu;
var init_ipc_net = __esm({
  "out-build/vs/base/parts/ipc/common/ipc.net.js"() {
    "use strict";
    init_buffer();
    init_event();
    init_lifecycle();
    init_ipc();
    (function(SocketDiagnosticsEventType2) {
      SocketDiagnosticsEventType2["Created"] = "created";
      SocketDiagnosticsEventType2["Read"] = "read";
      SocketDiagnosticsEventType2["Write"] = "write";
      SocketDiagnosticsEventType2["Open"] = "open";
      SocketDiagnosticsEventType2["Error"] = "error";
      SocketDiagnosticsEventType2["Close"] = "close";
      SocketDiagnosticsEventType2["BrowserWebSocketBlobReceived"] = "browserWebSocketBlobReceived";
      SocketDiagnosticsEventType2["NodeEndReceived"] = "nodeEndReceived";
      SocketDiagnosticsEventType2["NodeEndSent"] = "nodeEndSent";
      SocketDiagnosticsEventType2["NodeDrainBegin"] = "nodeDrainBegin";
      SocketDiagnosticsEventType2["NodeDrainEnd"] = "nodeDrainEnd";
      SocketDiagnosticsEventType2["zlibInflateError"] = "zlibInflateError";
      SocketDiagnosticsEventType2["zlibInflateData"] = "zlibInflateData";
      SocketDiagnosticsEventType2["zlibInflateInitialWrite"] = "zlibInflateInitialWrite";
      SocketDiagnosticsEventType2["zlibInflateInitialFlushFired"] = "zlibInflateInitialFlushFired";
      SocketDiagnosticsEventType2["zlibInflateWrite"] = "zlibInflateWrite";
      SocketDiagnosticsEventType2["zlibInflateFlushFired"] = "zlibInflateFlushFired";
      SocketDiagnosticsEventType2["zlibDeflateError"] = "zlibDeflateError";
      SocketDiagnosticsEventType2["zlibDeflateData"] = "zlibDeflateData";
      SocketDiagnosticsEventType2["zlibDeflateWrite"] = "zlibDeflateWrite";
      SocketDiagnosticsEventType2["zlibDeflateFlushFired"] = "zlibDeflateFlushFired";
      SocketDiagnosticsEventType2["WebSocketNodeSocketWrite"] = "webSocketNodeSocketWrite";
      SocketDiagnosticsEventType2["WebSocketNodeSocketPeekedHeader"] = "webSocketNodeSocketPeekedHeader";
      SocketDiagnosticsEventType2["WebSocketNodeSocketReadHeader"] = "webSocketNodeSocketReadHeader";
      SocketDiagnosticsEventType2["WebSocketNodeSocketReadData"] = "webSocketNodeSocketReadData";
      SocketDiagnosticsEventType2["WebSocketNodeSocketUnmaskedData"] = "webSocketNodeSocketUnmaskedData";
      SocketDiagnosticsEventType2["WebSocketNodeSocketDrainBegin"] = "webSocketNodeSocketDrainBegin";
      SocketDiagnosticsEventType2["WebSocketNodeSocketDrainEnd"] = "webSocketNodeSocketDrainEnd";
      SocketDiagnosticsEventType2["ProtocolHeaderRead"] = "protocolHeaderRead";
      SocketDiagnosticsEventType2["ProtocolMessageRead"] = "protocolMessageRead";
      SocketDiagnosticsEventType2["ProtocolHeaderWrite"] = "protocolHeaderWrite";
      SocketDiagnosticsEventType2["ProtocolMessageWrite"] = "protocolMessageWrite";
      SocketDiagnosticsEventType2["ProtocolWrite"] = "protocolWrite";
    })(SocketDiagnosticsEventType || (SocketDiagnosticsEventType = {}));
    (function(SocketDiagnostics2) {
      SocketDiagnostics2.enableDiagnostics = false;
      SocketDiagnostics2.records = [];
      const socketIds = /* @__PURE__ */ new WeakMap();
      let lastUsedSocketId = 0;
      function getSocketId(nativeObject, label) {
        if (!socketIds.has(nativeObject)) {
          const id2 = String(++lastUsedSocketId);
          socketIds.set(nativeObject, id2);
        }
        return socketIds.get(nativeObject);
      }
      function traceSocketEvent(nativeObject, socketDebugLabel, type2, data) {
        if (!SocketDiagnostics2.enableDiagnostics) {
          return;
        }
        const id2 = getSocketId(nativeObject, socketDebugLabel);
        if (data instanceof $Ci || data instanceof Uint8Array || data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
          const copiedData = $Ci.alloc(data.byteLength);
          copiedData.set(data);
          SocketDiagnostics2.records.push({ timestamp: Date.now(), id: id2, label: socketDebugLabel, type: type2, buff: copiedData });
        } else {
          SocketDiagnostics2.records.push({ timestamp: Date.now(), id: id2, label: socketDebugLabel, type: type2, data });
        }
      }
      SocketDiagnostics2.traceSocketEvent = traceSocketEvent;
    })(SocketDiagnostics || (SocketDiagnostics = {}));
    (function(SocketCloseEventType2) {
      SocketCloseEventType2[SocketCloseEventType2["NodeSocketCloseEvent"] = 0] = "NodeSocketCloseEvent";
      SocketCloseEventType2[SocketCloseEventType2["WebSocketCloseEvent"] = 1] = "WebSocketCloseEvent";
    })(SocketCloseEventType || (SocketCloseEventType = {}));
    emptyBuffer = null;
    $pu = class {
      get byteLength() {
        return this.b;
      }
      constructor() {
        this.a = [];
        this.b = 0;
      }
      acceptChunk(buff) {
        this.a.push(buff);
        this.b += buff.byteLength;
      }
      read(byteCount) {
        return this.c(byteCount, true);
      }
      peek(byteCount) {
        return this.c(byteCount, false);
      }
      c(byteCount, advance) {
        if (byteCount === 0) {
          return getEmptyBuffer();
        }
        if (byteCount > this.b) {
          throw new Error(`Cannot read so many bytes!`);
        }
        if (this.a[0].byteLength === byteCount) {
          const result2 = this.a[0];
          if (advance) {
            this.a.shift();
            this.b -= byteCount;
          }
          return result2;
        }
        if (this.a[0].byteLength > byteCount) {
          const result2 = this.a[0].slice(0, byteCount);
          if (advance) {
            this.a[0] = this.a[0].slice(byteCount);
            this.b -= byteCount;
          }
          return result2;
        }
        const result = $Ci.alloc(byteCount);
        let resultOffset = 0;
        let chunkIndex = 0;
        while (byteCount > 0) {
          const chunk = this.a[chunkIndex];
          if (chunk.byteLength > byteCount) {
            const chunkPart = chunk.slice(0, byteCount);
            result.set(chunkPart, resultOffset);
            resultOffset += byteCount;
            if (advance) {
              this.a[chunkIndex] = chunk.slice(byteCount);
              this.b -= byteCount;
            }
            byteCount -= byteCount;
          } else {
            result.set(chunk, resultOffset);
            resultOffset += chunk.byteLength;
            if (advance) {
              this.a.shift();
              this.b -= chunk.byteLength;
            } else {
              chunkIndex++;
            }
            byteCount -= chunk.byteLength;
          }
        }
        return result;
      }
    };
    (function(ProtocolMessageType2) {
      ProtocolMessageType2[ProtocolMessageType2["None"] = 0] = "None";
      ProtocolMessageType2[ProtocolMessageType2["Regular"] = 1] = "Regular";
      ProtocolMessageType2[ProtocolMessageType2["Control"] = 2] = "Control";
      ProtocolMessageType2[ProtocolMessageType2["Ack"] = 3] = "Ack";
      ProtocolMessageType2[ProtocolMessageType2["Disconnect"] = 5] = "Disconnect";
      ProtocolMessageType2[ProtocolMessageType2["ReplayRequest"] = 6] = "ReplayRequest";
      ProtocolMessageType2[ProtocolMessageType2["Pause"] = 7] = "Pause";
      ProtocolMessageType2[ProtocolMessageType2["Resume"] = 8] = "Resume";
      ProtocolMessageType2[ProtocolMessageType2["KeepAlive"] = 9] = "KeepAlive";
    })(ProtocolMessageType || (ProtocolMessageType = {}));
    (function(ProtocolConstants2) {
      ProtocolConstants2[ProtocolConstants2["HeaderLength"] = 13] = "HeaderLength";
      ProtocolConstants2[ProtocolConstants2["AcknowledgeTime"] = 2e3] = "AcknowledgeTime";
      ProtocolConstants2[ProtocolConstants2["TimeoutTime"] = 2e4] = "TimeoutTime";
      ProtocolConstants2[ProtocolConstants2["ReconnectionGraceTime"] = 108e5] = "ReconnectionGraceTime";
      ProtocolConstants2[ProtocolConstants2["ReconnectionShortGraceTime"] = 3e5] = "ReconnectionShortGraceTime";
      ProtocolConstants2[ProtocolConstants2["KeepAliveSendTime"] = 5e3] = "KeepAliveSendTime";
    })(ProtocolConstants || (ProtocolConstants = {}));
    ProtocolMessage = class {
      constructor(type2, id2, ack, data) {
        this.type = type2;
        this.id = id2;
        this.ack = ack;
        this.data = data;
        this.writtenTime = 0;
      }
      get size() {
        return this.data.byteLength;
      }
    };
    ProtocolReader = class extends $3c {
      constructor(socket) {
        super();
        this.f = this.B(new $ze());
        this.onMessage = this.f.event;
        this.g = {
          readHead: true,
          readLen: 13,
          messageType: 0,
          id: 0,
          ack: 0
        };
        this.a = socket;
        this.b = false;
        this.c = new $pu();
        this.B(this.a.onData((data) => this.acceptChunk(data)));
        this.lastReadTime = Date.now();
      }
      acceptChunk(data) {
        if (!data || data.byteLength === 0) {
          return;
        }
        this.lastReadTime = Date.now();
        this.c.acceptChunk(data);
        while (this.c.byteLength >= this.g.readLen) {
          const buff = this.c.read(this.g.readLen);
          if (this.g.readHead) {
            this.g.readHead = false;
            this.g.readLen = buff.readUInt32BE(9);
            this.g.messageType = buff.readUInt8(0);
            this.g.id = buff.readUInt32BE(1);
            this.g.ack = buff.readUInt32BE(5);
            this.a.traceSocketEvent("protocolHeaderRead", { messageType: protocolMessageTypeToString(this.g.messageType), id: this.g.id, ack: this.g.ack, messageSize: this.g.readLen });
          } else {
            const messageType = this.g.messageType;
            const id2 = this.g.id;
            const ack = this.g.ack;
            this.g.readHead = true;
            this.g.readLen = 13;
            this.g.messageType = 0;
            this.g.id = 0;
            this.g.ack = 0;
            this.a.traceSocketEvent("protocolMessageRead", buff);
            this.f.fire(new ProtocolMessage(messageType, id2, ack, buff));
            if (this.b) {
              break;
            }
          }
        }
      }
      readEntireBuffer() {
        return this.c.read(this.c.byteLength);
      }
      dispose() {
        this.b = true;
        super.dispose();
      }
    };
    ProtocolWriter = class {
      constructor(socket) {
        this.k = null;
        this.a = false;
        this.b = false;
        this.c = socket;
        this.d = [];
        this.f = 0;
        this.lastWriteTime = 0;
      }
      dispose() {
        try {
          this.flush();
        } catch (err) {
        }
        this.a = true;
      }
      drain() {
        this.flush();
        return this.c.drain();
      }
      flush() {
        this.m();
      }
      pause() {
        this.b = true;
      }
      resume() {
        this.b = false;
        this.l();
      }
      write(msg) {
        if (this.a) {
          return;
        }
        msg.writtenTime = Date.now();
        this.lastWriteTime = Date.now();
        const header = $Ci.alloc(
          13
          /* ProtocolConstants.HeaderLength */
        );
        header.writeUInt8(msg.type, 0);
        header.writeUInt32BE(msg.id, 1);
        header.writeUInt32BE(msg.ack, 5);
        header.writeUInt32BE(msg.data.byteLength, 9);
        this.c.traceSocketEvent("protocolHeaderWrite", { messageType: protocolMessageTypeToString(msg.type), id: msg.id, ack: msg.ack, messageSize: msg.data.byteLength });
        this.c.traceSocketEvent("protocolMessageWrite", msg.data);
        this.j(header, msg.data);
      }
      g(head, body) {
        const wasEmpty = this.f === 0;
        this.d.push(head, body);
        this.f += head.byteLength + body.byteLength;
        return wasEmpty;
      }
      h() {
        const ret = $Ci.concat(this.d, this.f);
        this.d.length = 0;
        this.f = 0;
        return ret;
      }
      j(header, data) {
        if (this.g(header, data)) {
          this.l();
        }
      }
      l() {
        if (this.k) {
          return;
        }
        this.k = setTimeout(() => {
          this.k = null;
          this.m();
        });
      }
      m() {
        if (this.f === 0) {
          return;
        }
        if (this.b) {
          return;
        }
        const data = this.h();
        this.c.traceSocketEvent("protocolWrite", { byteLength: data.byteLength });
        this.c.write(data);
      }
    };
    $su = class {
      constructor() {
        this.b = false;
        this.c = false;
        this.d = [];
        this.a = new $ze({
          onWillAddFirstListener: () => {
            this.b = true;
            queueMicrotask(() => this.f());
          },
          onDidRemoveLastListener: () => {
            this.b = false;
          }
        });
        this.event = this.a.event;
      }
      f() {
        if (this.c) {
          return;
        }
        this.c = true;
        while (this.b && this.d.length > 0) {
          this.a.fire(this.d.shift());
        }
        this.c = false;
      }
      fire(event) {
        if (this.b) {
          if (this.d.length > 0) {
            this.d.push(event);
          } else {
            this.a.fire(event);
          }
        } else {
          this.d.push(event);
        }
      }
      flushBuffer() {
        this.d = [];
      }
    };
    QueueElement = class {
      constructor(data) {
        this.data = data;
        this.next = null;
      }
    };
    Queue = class {
      constructor() {
        this.a = null;
        this.b = null;
      }
      length() {
        let result = 0;
        let current = this.a;
        while (current) {
          current = current.next;
          result++;
        }
        return result;
      }
      peek() {
        if (!this.a) {
          return null;
        }
        return this.a.data;
      }
      toArray() {
        const result = [];
        let resultLen = 0;
        let it = this.a;
        while (it) {
          result[resultLen++] = it.data;
          it = it.next;
        }
        return result;
      }
      pop() {
        if (!this.a) {
          return;
        }
        if (this.a === this.b) {
          this.a = null;
          this.b = null;
          return;
        }
        this.a = this.a.next;
      }
      push(item) {
        const element = new QueueElement(item);
        if (!this.a) {
          this.a = element;
          this.b = element;
          return;
        }
        this.b.next = element;
        this.b = element;
      }
    };
    LoadEstimator = class _LoadEstimator {
      static {
        this.a = 10;
      }
      static {
        this.b = null;
      }
      static getInstance() {
        if (!_LoadEstimator.b) {
          _LoadEstimator.b = new _LoadEstimator();
        }
        return _LoadEstimator.b;
      }
      constructor() {
        this.c = [];
        const now2 = Date.now();
        for (let i = 0; i < _LoadEstimator.a; i++) {
          this.c[i] = now2 - 1e3 * i;
        }
        setInterval(() => {
          for (let i = _LoadEstimator.a; i >= 1; i--) {
            this.c[i] = this.c[i - 1];
          }
          this.c[0] = Date.now();
        }, 1e3);
      }
      /**
       * returns an estimative number, from 0 (low load) to 1 (high load)
       */
      d() {
        const now2 = Date.now();
        const historyLimit = (1 + _LoadEstimator.a) * 1e3;
        let score = 0;
        for (let i = 0; i < _LoadEstimator.a; i++) {
          if (now2 - this.c[i] <= historyLimit) {
            score++;
          }
        }
        return 1 - score / _LoadEstimator.a;
      }
      hasHighLoad() {
        return this.d() >= 0.5;
      }
    };
    $tu = class {
      get unacknowledgedCount() {
        return this.d - this.f;
      }
      constructor(opts) {
        this.v = new $su();
        this.onControlMessage = this.v.event;
        this.w = new $su();
        this.onMessage = this.w.event;
        this.x = new $su();
        this.onDidDispose = this.x.event;
        this.y = new $su();
        this.onSocketClose = this.y.event;
        this.z = new $su();
        this.onSocketTimeout = this.z.event;
        this.t = opts.loadEstimator ?? LoadEstimator.getInstance();
        this.u = opts.sendKeepAlive ?? true;
        this.a = false;
        this.c = new Queue();
        this.d = 0;
        this.f = 0;
        this.g = null;
        this.h = 0;
        this.j = 0;
        this.k = 0;
        this.l = null;
        this.n = 0;
        this.o = Date.now();
        this.s = new $2c();
        this.p = opts.socket;
        this.q = this.s.add(new ProtocolWriter(this.p));
        this.r = this.s.add(new ProtocolReader(this.p));
        this.s.add(this.r.onMessage((msg) => this.A(msg)));
        this.s.add(this.p.onClose((e) => this.y.fire(e)));
        if (opts.initialChunk) {
          this.r.acceptChunk(opts.initialChunk);
        }
        if (this.u) {
          this.m = setInterval(
            () => {
              this.E();
            },
            5e3
            /* ProtocolConstants.KeepAliveSendTime */
          );
        } else {
          this.m = null;
        }
      }
      dispose() {
        if (this.g) {
          clearTimeout(this.g);
          this.g = null;
        }
        if (this.l) {
          clearTimeout(this.l);
          this.l = null;
        }
        if (this.m) {
          clearInterval(this.m);
          this.m = null;
        }
        this.s.dispose();
      }
      drain() {
        return this.q.drain();
      }
      sendDisconnect() {
        if (!this.b) {
          this.b = true;
          const msg = new ProtocolMessage(5, 0, 0, getEmptyBuffer());
          this.q.write(msg);
          this.q.flush();
        }
      }
      sendPause() {
        const msg = new ProtocolMessage(7, 0, 0, getEmptyBuffer());
        this.q.write(msg);
      }
      sendResume() {
        const msg = new ProtocolMessage(8, 0, 0, getEmptyBuffer());
        this.q.write(msg);
      }
      pauseSocketWriting() {
        this.q.pause();
      }
      getSocket() {
        return this.p;
      }
      getMillisSinceLastIncomingData() {
        return Date.now() - this.r.lastReadTime;
      }
      beginAcceptReconnection(socket, initialDataChunk) {
        this.a = true;
        this.s.dispose();
        this.s = new $2c();
        this.v.flushBuffer();
        this.y.flushBuffer();
        this.z.flushBuffer();
        this.p.dispose();
        this.n = 0;
        this.o = Date.now();
        this.p = socket;
        this.q = this.s.add(new ProtocolWriter(this.p));
        this.r = this.s.add(new ProtocolReader(this.p));
        this.s.add(this.r.onMessage((msg) => this.A(msg)));
        this.s.add(this.p.onClose((e) => this.y.fire(e)));
        this.r.acceptChunk(initialDataChunk);
      }
      endAcceptReconnection() {
        this.a = false;
        this.j = this.h;
        const msg = new ProtocolMessage(3, 0, this.j, getEmptyBuffer());
        this.q.write(msg);
        const toSend = this.c.toArray();
        for (let i = 0, len = toSend.length; i < len; i++) {
          this.q.write(toSend[i]);
        }
        this.C();
      }
      acceptDisconnect() {
        this.x.fire();
      }
      A(msg) {
        if (msg.ack > this.f) {
          this.f = msg.ack;
          do {
            const first = this.c.peek();
            if (first && first.id <= msg.ack) {
              this.c.pop();
            } else {
              break;
            }
          } while (true);
        }
        switch (msg.type) {
          case 0: {
            break;
          }
          case 1: {
            if (msg.id > this.h) {
              if (msg.id !== this.h + 1) {
                const now2 = Date.now();
                if (now2 - this.n > 1e4) {
                  this.n = now2;
                  this.q.write(new ProtocolMessage(6, 0, 0, getEmptyBuffer()));
                }
              } else {
                this.h = msg.id;
                this.k = Date.now();
                this.B();
                this.w.fire(msg.data);
              }
            }
            break;
          }
          case 2: {
            this.v.fire(msg.data);
            break;
          }
          case 3: {
            break;
          }
          case 5: {
            this.x.fire();
            break;
          }
          case 6: {
            const toSend = this.c.toArray();
            for (let i = 0, len = toSend.length; i < len; i++) {
              this.q.write(toSend[i]);
            }
            this.C();
            break;
          }
          case 7: {
            this.q.pause();
            break;
          }
          case 8: {
            this.q.resume();
            break;
          }
          case 9: {
            break;
          }
        }
      }
      readEntireBuffer() {
        return this.r.readEntireBuffer();
      }
      flush() {
        this.q.flush();
      }
      send(buffer) {
        const myId = ++this.d;
        this.j = this.h;
        const msg = new ProtocolMessage(1, myId, this.j, buffer);
        this.c.push(msg);
        if (!this.a) {
          this.q.write(msg);
          this.C();
        }
      }
      /**
       * Send a message which will not be part of the regular acknowledge flow.
       * Use this for early control messages which are repeated in case of reconnection.
       */
      sendControl(buffer) {
        const msg = new ProtocolMessage(2, 0, 0, buffer);
        this.q.write(msg);
      }
      B() {
        if (this.h <= this.j) {
          return;
        }
        if (this.l) {
          return;
        }
        const timeSinceLastIncomingMsg = Date.now() - this.k;
        if (timeSinceLastIncomingMsg >= 2e3) {
          this.D();
          return;
        }
        this.l = setTimeout(() => {
          this.l = null;
          this.B();
        }, 2e3 - timeSinceLastIncomingMsg + 5);
      }
      C() {
        if (this.d <= this.f) {
          return;
        }
        if (this.g) {
          return;
        }
        if (this.a) {
          return;
        }
        const oldestUnacknowledgedMsg = this.c.peek();
        const timeSinceOldestUnacknowledgedMsg = Date.now() - oldestUnacknowledgedMsg.writtenTime;
        const timeSinceLastReceivedSomeData = Date.now() - this.r.lastReadTime;
        const timeSinceLastTimeout = Date.now() - this.o;
        if (timeSinceOldestUnacknowledgedMsg >= 2e4 && timeSinceLastReceivedSomeData >= 2e4 && timeSinceLastTimeout >= 2e4) {
          if (!this.t.hasHighLoad()) {
            this.o = Date.now();
            this.z.fire({
              unacknowledgedMsgCount: this.c.length(),
              timeSinceOldestUnacknowledgedMsg,
              timeSinceLastReceivedSomeData
            });
            return;
          }
        }
        const minimumTimeUntilTimeout = Math.max(2e4 - timeSinceOldestUnacknowledgedMsg, 2e4 - timeSinceLastReceivedSomeData, 2e4 - timeSinceLastTimeout, 500);
        this.g = setTimeout(() => {
          this.g = null;
          this.C();
        }, minimumTimeUntilTimeout);
      }
      D() {
        if (this.h <= this.j) {
          return;
        }
        this.j = this.h;
        const msg = new ProtocolMessage(3, 0, this.j, getEmptyBuffer());
        this.q.write(msg);
      }
      E() {
        this.j = this.h;
        const msg = new ProtocolMessage(9, 0, this.j, getEmptyBuffer());
        this.q.write(msg);
      }
    };
  }
});

// out-build/vs/base/parts/ipc/node/ipc.net.js
import { createHash as createHash2 } from "crypto";
import { createServer as createServer2, createConnection } from "net";
import { tmpdir as tmpdir3 } from "os";
import { createDeflateRaw, createInflateRaw } from "zlib";
function unmask(buffer, mask) {
  if (mask === 0) {
    return;
  }
  const cnt = buffer.byteLength >>> 2;
  for (let i = 0; i < cnt; i++) {
    const v = buffer.readUInt32BE(i * 4);
    buffer.writeUInt32BE(v ^ mask, i * 4);
  }
  const offset = cnt * 4;
  const bytesLeft = buffer.byteLength - offset;
  const m3 = mask >>> 24 & 255;
  const m2 = mask >>> 16 & 255;
  const m1 = mask >>> 8 & 255;
  if (bytesLeft >= 1) {
    buffer.writeUInt8(buffer.readUInt8(offset) ^ m3, offset);
  }
  if (bytesLeft >= 2) {
    buffer.writeUInt8(buffer.readUInt8(offset + 1) ^ m2, offset + 1);
  }
  if (bytesLeft >= 3) {
    buffer.writeUInt8(buffer.readUInt8(offset + 2) ^ m1, offset + 2);
  }
}
function $xu() {
  const randomSuffix = $ps();
  if (process.platform === "win32") {
    return `\\\\.\\pipe\\vscode-ipc-${randomSuffix}-sock`;
  }
  const basePath = process.platform !== "darwin" && $wu ? $wu : tmpdir3();
  const result = $nc(basePath, `vscode-ipc-${randomSuffix}.sock`);
  validateIPCHandleLength(result);
  return result;
}
function validateIPCHandleLength(handle) {
  const limit = safeIpcPathLengths[$x];
  if (typeof limit === "number" && handle.length >= limit) {
    console.warn(`WARNING: IPC handle "${handle}" is longer than ${limit} chars, try a shorter --user-data-dir`);
  }
}
var socketEndTimeoutMs, $uu, Constants, ReadState, $vu, WebSocketFlowManager, ZlibInflateStream, ZlibDeflateStream, $wu, safeIpcPathLengths;
var init_ipc_net2 = __esm({
  "out-build/vs/base/parts/ipc/node/ipc.net.js"() {
    "use strict";
    init_buffer();
    init_errors();
    init_event();
    init_lifecycle();
    init_path();
    init_platform();
    init_uuid();
    init_ipc();
    init_ipc_net();
    socketEndTimeoutMs = 3e4;
    $uu = class {
      traceSocketEvent(type2, data) {
        SocketDiagnostics.traceSocketEvent(this.socket, this.debugLabel, type2, data);
      }
      constructor(socket, debugLabel = "") {
        this.f = true;
        this.debugLabel = debugLabel;
        this.socket = socket;
        this.traceSocketEvent("created", { type: "NodeSocket" });
        this.a = (err) => {
          this.traceSocketEvent("error", { code: err?.code, message: err?.message });
          if (err) {
            if (err.code === "EPIPE") {
              return;
            }
            $gb(err);
          }
        };
        this.socket.on("error", this.a);
        let endTimeoutHandle;
        this.b = (hadError) => {
          this.traceSocketEvent("close", { hadError });
          this.f = false;
          if (endTimeoutHandle) {
            clearTimeout(endTimeoutHandle);
          }
        };
        this.socket.on("close", this.b);
        this.d = () => {
          this.traceSocketEvent(
            "nodeEndReceived"
            /* SocketDiagnosticsEventType.NodeEndReceived */
          );
          this.f = false;
          endTimeoutHandle = setTimeout(() => socket.destroy(), socketEndTimeoutMs);
        };
        this.socket.on("end", this.d);
      }
      dispose() {
        this.socket.off("error", this.a);
        this.socket.off("close", this.b);
        this.socket.off("end", this.d);
        this.socket.destroy();
      }
      onData(_listener) {
        const listener = (buff) => {
          this.traceSocketEvent("read", buff);
          _listener($Ci.wrap(buff));
        };
        this.socket.on("data", listener);
        return {
          dispose: () => this.socket.off("data", listener)
        };
      }
      onClose(listener) {
        const adapter = (hadError) => {
          listener({
            type: 0,
            hadError,
            error: void 0
          });
        };
        this.socket.on("close", adapter);
        return {
          dispose: () => this.socket.off("close", adapter)
        };
      }
      onEnd(listener) {
        const adapter = () => {
          listener();
        };
        this.socket.on("end", adapter);
        return {
          dispose: () => this.socket.off("end", adapter)
        };
      }
      write(buffer) {
        if (this.socket.destroyed || !this.f) {
          return;
        }
        try {
          this.traceSocketEvent("write", buffer);
          this.socket.write(buffer.buffer, (err) => {
            if (err) {
              if (err.code === "EPIPE") {
                return;
              }
              $gb(err);
            }
          });
        } catch (err) {
          if (err.code === "EPIPE") {
            return;
          }
          $gb(err);
        }
      }
      end() {
        this.traceSocketEvent(
          "nodeEndSent"
          /* SocketDiagnosticsEventType.NodeEndSent */
        );
        this.socket.end();
      }
      drain() {
        this.traceSocketEvent(
          "nodeDrainBegin"
          /* SocketDiagnosticsEventType.NodeDrainBegin */
        );
        return new Promise((resolve4, reject) => {
          if (this.socket.bufferSize === 0) {
            this.traceSocketEvent(
              "nodeDrainEnd"
              /* SocketDiagnosticsEventType.NodeDrainEnd */
            );
            resolve4();
            return;
          }
          const finished = () => {
            this.socket.off("close", finished);
            this.socket.off("end", finished);
            this.socket.off("error", finished);
            this.socket.off("timeout", finished);
            this.socket.off("drain", finished);
            this.traceSocketEvent(
              "nodeDrainEnd"
              /* SocketDiagnosticsEventType.NodeDrainEnd */
            );
            resolve4();
          };
          this.socket.on("close", finished);
          this.socket.on("end", finished);
          this.socket.on("error", finished);
          this.socket.on("timeout", finished);
          this.socket.on("drain", finished);
        });
      }
    };
    (function(Constants4) {
      Constants4[Constants4["MinHeaderByteSize"] = 2] = "MinHeaderByteSize";
      Constants4[Constants4["MaxWebSocketMessageLength"] = 262144] = "MaxWebSocketMessageLength";
    })(Constants || (Constants = {}));
    (function(ReadState2) {
      ReadState2[ReadState2["PeekHeader"] = 1] = "PeekHeader";
      ReadState2[ReadState2["ReadHeader"] = 2] = "ReadHeader";
      ReadState2[ReadState2["ReadBody"] = 3] = "ReadBody";
      ReadState2[ReadState2["Fin"] = 4] = "Fin";
    })(ReadState || (ReadState = {}));
    $vu = class extends $3c {
      get permessageDeflate() {
        return this.a.permessageDeflate;
      }
      get recordedInflateBytes() {
        return this.a.recordedInflateBytes;
      }
      traceSocketEvent(type2, data) {
        this.socket.traceSocketEvent(type2, data);
      }
      /**
       * Create a socket which can communicate using WebSocket frames.
       *
       * **NOTE**: When using the permessage-deflate WebSocket extension, if parts of inflating was done
       *  in a different zlib instance, we need to pass all those bytes into zlib, otherwise the inflate
       *  might hit an inflated portion referencing a distance too far back.
       *
       * @param socket The underlying socket
       * @param permessageDeflate Use the permessage-deflate WebSocket extension
       * @param inflateBytes "Seed" zlib inflate with these bytes.
       * @param recordInflateBytes Record all bytes sent to inflate
       */
      constructor(socket, permessageDeflate, inflateBytes, recordInflateBytes) {
        super();
        this.f = this.B(new $ze());
        this.g = this.B(new $ze());
        this.h = false;
        this.j = {
          state: 1,
          readLen: 2,
          fin: 0,
          compressed: false,
          firstFrameOfMessage: true,
          mask: 0,
          opcode: 0
        };
        this.socket = socket;
        this.traceSocketEvent("created", { type: "WebSocketNodeSocket", permessageDeflate, inflateBytesLength: inflateBytes?.byteLength || 0, recordInflateBytes });
        this.a = this.B(new WebSocketFlowManager(this, permessageDeflate, inflateBytes, recordInflateBytes, this.f, (data, options2) => this.m(data, options2)));
        this.B(this.a.onError((err) => {
          console.error(err);
          $gb(err);
          this.g.fire({
            type: 0,
            hadError: true,
            error: err
          });
        }));
        this.b = new $pu();
        this.B(this.socket.onData((data) => this.n(data)));
        this.B(this.socket.onClose(async (e) => {
          if (this.a.isProcessingReadQueue()) {
            await Event.toPromise(this.a.onDidFinishProcessingReadQueue);
          }
          this.g.fire(e);
        }));
      }
      dispose() {
        if (this.a.isProcessingWriteQueue()) {
          this.B(this.a.onDidFinishProcessingWriteQueue(() => {
            this.dispose();
          }));
        } else {
          this.socket.dispose();
          super.dispose();
        }
      }
      onData(listener) {
        return this.f.event(listener);
      }
      onClose(listener) {
        return this.g.event(listener);
      }
      onEnd(listener) {
        return this.socket.onEnd(listener);
      }
      write(buffer) {
        let start = 0;
        while (start < buffer.byteLength) {
          this.a.writeMessage(buffer.slice(start, Math.min(start + 262144, buffer.byteLength)), {
            compressed: true,
            opcode: 2
            /* Binary frame */
          });
          start += 262144;
        }
      }
      m(buffer, { compressed, opcode }) {
        if (this.h) {
          return;
        }
        this.traceSocketEvent("webSocketNodeSocketWrite", buffer);
        let headerLen = 2;
        if (buffer.byteLength < 126) {
          headerLen += 0;
        } else if (buffer.byteLength < 2 ** 16) {
          headerLen += 2;
        } else {
          headerLen += 8;
        }
        const header = $Ci.alloc(headerLen);
        const compressedFlag = compressed ? 64 : 0;
        const opcodeFlag = opcode & 15;
        header.writeUInt8(128 | compressedFlag | opcodeFlag, 0);
        if (buffer.byteLength < 126) {
          header.writeUInt8(buffer.byteLength, 1);
        } else if (buffer.byteLength < 2 ** 16) {
          header.writeUInt8(126, 1);
          let offset = 1;
          header.writeUInt8(buffer.byteLength >>> 8 & 255, ++offset);
          header.writeUInt8(buffer.byteLength >>> 0 & 255, ++offset);
        } else {
          header.writeUInt8(127, 1);
          let offset = 1;
          header.writeUInt8(0, ++offset);
          header.writeUInt8(0, ++offset);
          header.writeUInt8(0, ++offset);
          header.writeUInt8(0, ++offset);
          header.writeUInt8(buffer.byteLength >>> 24 & 255, ++offset);
          header.writeUInt8(buffer.byteLength >>> 16 & 255, ++offset);
          header.writeUInt8(buffer.byteLength >>> 8 & 255, ++offset);
          header.writeUInt8(buffer.byteLength >>> 0 & 255, ++offset);
        }
        this.socket.write($Ci.concat([header, buffer]));
      }
      end() {
        this.h = true;
        this.socket.end();
      }
      n(data) {
        if (data.byteLength === 0) {
          return;
        }
        this.b.acceptChunk(data);
        while (this.b.byteLength >= this.j.readLen) {
          if (this.j.state === 1) {
            const peekHeader = this.b.peek(this.j.readLen);
            const firstByte = peekHeader.readUInt8(0);
            const finBit = (firstByte & 128) >>> 7;
            const rsv1Bit = (firstByte & 64) >>> 6;
            const opcode = firstByte & 15;
            const secondByte = peekHeader.readUInt8(1);
            const hasMask = (secondByte & 128) >>> 7;
            const len = secondByte & 127;
            this.j.state = 2;
            this.j.readLen = 2 + (hasMask ? 4 : 0) + (len === 126 ? 2 : 0) + (len === 127 ? 8 : 0);
            this.j.fin = finBit;
            if (this.j.firstFrameOfMessage) {
              this.j.compressed = Boolean(rsv1Bit);
            }
            this.j.firstFrameOfMessage = Boolean(finBit);
            this.j.mask = 0;
            this.j.opcode = opcode;
            this.traceSocketEvent("webSocketNodeSocketPeekedHeader", { headerSize: this.j.readLen, compressed: this.j.compressed, fin: this.j.fin, opcode: this.j.opcode });
          } else if (this.j.state === 2) {
            const header = this.b.read(this.j.readLen);
            const secondByte = header.readUInt8(1);
            const hasMask = (secondByte & 128) >>> 7;
            let len = secondByte & 127;
            let offset = 1;
            if (len === 126) {
              len = header.readUInt8(++offset) * 2 ** 8 + header.readUInt8(++offset);
            } else if (len === 127) {
              len = header.readUInt8(++offset) * 0 + header.readUInt8(++offset) * 0 + header.readUInt8(++offset) * 0 + header.readUInt8(++offset) * 0 + header.readUInt8(++offset) * 2 ** 24 + header.readUInt8(++offset) * 2 ** 16 + header.readUInt8(++offset) * 2 ** 8 + header.readUInt8(++offset);
            }
            let mask = 0;
            if (hasMask) {
              mask = header.readUInt8(++offset) * 2 ** 24 + header.readUInt8(++offset) * 2 ** 16 + header.readUInt8(++offset) * 2 ** 8 + header.readUInt8(++offset);
            }
            this.j.state = 3;
            this.j.readLen = len;
            this.j.mask = mask;
            this.traceSocketEvent("webSocketNodeSocketPeekedHeader", { bodySize: this.j.readLen, compressed: this.j.compressed, fin: this.j.fin, mask: this.j.mask, opcode: this.j.opcode });
          } else if (this.j.state === 3) {
            const body = this.b.read(this.j.readLen);
            this.traceSocketEvent("webSocketNodeSocketReadData", body);
            unmask(body, this.j.mask);
            this.traceSocketEvent("webSocketNodeSocketUnmaskedData", body);
            this.j.state = 1;
            this.j.readLen = 2;
            this.j.mask = 0;
            if (this.j.opcode <= 2) {
              this.a.acceptFrame(body, this.j.compressed, !!this.j.fin);
            } else if (this.j.opcode === 9) {
              this.a.writeMessage(body, {
                compressed: false,
                opcode: 10
                /* Pong frame */
              });
            }
          }
        }
      }
      async drain() {
        this.traceSocketEvent(
          "webSocketNodeSocketDrainBegin"
          /* SocketDiagnosticsEventType.WebSocketNodeSocketDrainBegin */
        );
        if (this.a.isProcessingWriteQueue()) {
          await Event.toPromise(this.a.onDidFinishProcessingWriteQueue);
        }
        await this.socket.drain();
        this.traceSocketEvent(
          "webSocketNodeSocketDrainEnd"
          /* SocketDiagnosticsEventType.WebSocketNodeSocketDrainEnd */
        );
      }
    };
    WebSocketFlowManager = class extends $3c {
      get permessageDeflate() {
        return Boolean(this.b && this.f);
      }
      get recordedInflateBytes() {
        if (this.b) {
          return this.b.recordedInflateBytes;
        }
        return $Ci.alloc(0);
      }
      constructor(n, permessageDeflate, inflateBytes, recordInflateBytes, r, s) {
        super();
        this.n = n;
        this.r = r;
        this.s = s;
        this.a = this.B(new $ze());
        this.onError = this.a.event;
        this.g = [];
        this.h = [];
        this.j = this.B(new $ze());
        this.onDidFinishProcessingReadQueue = this.j.event;
        this.m = this.B(new $ze());
        this.onDidFinishProcessingWriteQueue = this.m.event;
        this.t = false;
        this.y = false;
        if (permessageDeflate) {
          this.b = this.B(new ZlibInflateStream(this.n, recordInflateBytes, inflateBytes, { windowBits: 15 }));
          this.f = this.B(new ZlibDeflateStream(this.n, { windowBits: 15 }));
          this.B(this.b.onError((err) => this.a.fire(err)));
          this.B(this.f.onError((err) => this.a.fire(err)));
        } else {
          this.b = null;
          this.f = null;
        }
      }
      writeMessage(data, options2) {
        this.g.push({ data, options: options2 });
        this.u();
      }
      async u() {
        if (this.t) {
          return;
        }
        this.t = true;
        while (this.g.length > 0) {
          const { data, options: options2 } = this.g.shift();
          if (this.f && options2.compressed) {
            const compressedData = await this.w(this.f, data);
            this.s(compressedData, options2);
          } else {
            this.s(data, { ...options2, compressed: false });
          }
        }
        this.t = false;
        this.m.fire();
      }
      isProcessingWriteQueue() {
        return this.t;
      }
      /**
       * Subsequent calls should wait for the previous `_deflateBuffer` call to complete.
       */
      w(zlibDeflateStream, buffer) {
        return new Promise((resolve4, reject) => {
          zlibDeflateStream.write(buffer);
          zlibDeflateStream.flush((data) => resolve4(data));
        });
      }
      acceptFrame(data, isCompressed, isLastFrameOfMessage) {
        this.h.push({ data, isCompressed, isLastFrameOfMessage });
        this.z();
      }
      async z() {
        if (this.y) {
          return;
        }
        this.y = true;
        while (this.h.length > 0) {
          const frameInfo = this.h.shift();
          if (this.b && frameInfo.isCompressed) {
            const data = await this.C(this.b, frameInfo.data, frameInfo.isLastFrameOfMessage);
            this.r.fire(data);
          } else {
            this.r.fire(frameInfo.data);
          }
        }
        this.y = false;
        this.j.fire();
      }
      isProcessingReadQueue() {
        return this.y;
      }
      /**
       * Subsequent calls should wait for the previous `transformRead` call to complete.
       */
      C(zlibInflateStream, buffer, isLastFrameOfMessage) {
        return new Promise((resolve4, reject) => {
          zlibInflateStream.write(buffer);
          if (isLastFrameOfMessage) {
            zlibInflateStream.write($Ci.fromByteArray([0, 0, 255, 255]));
          }
          zlibInflateStream.flush((data) => resolve4(data));
        });
      }
    };
    ZlibInflateStream = class extends $3c {
      get recordedInflateBytes() {
        if (this.j) {
          return $Ci.concat(this.f);
        }
        return $Ci.alloc(0);
      }
      constructor(h, j, inflateBytes, options2) {
        super();
        this.h = h;
        this.j = j;
        this.a = this.B(new $ze());
        this.onError = this.a.event;
        this.f = [];
        this.g = [];
        this.b = createInflateRaw(options2);
        this.b.on("error", (err) => {
          this.h.traceSocketEvent("zlibInflateError", { message: err?.message, code: err?.code });
          this.a.fire(err);
        });
        this.b.on("data", (data) => {
          this.h.traceSocketEvent("zlibInflateData", data);
          this.g.push($Ci.wrap(data));
        });
        if (inflateBytes) {
          this.h.traceSocketEvent("zlibInflateInitialWrite", inflateBytes.buffer);
          this.b.write(inflateBytes.buffer);
          this.b.flush(() => {
            this.h.traceSocketEvent(
              "zlibInflateInitialFlushFired"
              /* SocketDiagnosticsEventType.zlibInflateInitialFlushFired */
            );
            this.g.length = 0;
          });
        }
      }
      write(buffer) {
        if (this.j) {
          this.f.push(buffer.clone());
        }
        this.h.traceSocketEvent("zlibInflateWrite", buffer);
        this.b.write(buffer.buffer);
      }
      flush(callback) {
        this.b.flush(() => {
          this.h.traceSocketEvent(
            "zlibInflateFlushFired"
            /* SocketDiagnosticsEventType.zlibInflateFlushFired */
          );
          const data = $Ci.concat(this.g);
          this.g.length = 0;
          callback(data);
        });
      }
    };
    ZlibDeflateStream = class extends $3c {
      constructor(g, options2) {
        super();
        this.g = g;
        this.a = this.B(new $ze());
        this.onError = this.a.event;
        this.f = [];
        this.b = createDeflateRaw({
          windowBits: 15
        });
        this.b.on("error", (err) => {
          this.g.traceSocketEvent("zlibDeflateError", { message: err?.message, code: err?.code });
          this.a.fire(err);
        });
        this.b.on("data", (data) => {
          this.g.traceSocketEvent("zlibDeflateData", data);
          this.f.push($Ci.wrap(data));
        });
      }
      write(buffer) {
        this.g.traceSocketEvent("zlibDeflateWrite", buffer.buffer);
        this.b.write(buffer.buffer);
      }
      flush(callback) {
        this.b.flush(
          /*Z_SYNC_FLUSH*/
          2,
          () => {
            this.g.traceSocketEvent(
              "zlibDeflateFlushFired"
              /* SocketDiagnosticsEventType.zlibDeflateFlushFired */
            );
            let data = $Ci.concat(this.f);
            this.f.length = 0;
            data = data.slice(0, data.byteLength - 4);
            callback(data);
          }
        );
      }
    };
    $wu = process.env["XDG_RUNTIME_DIR"];
    safeIpcPathLengths = {
      [
        2
        /* Platform.Linux */
      ]: 107,
      [
        1
        /* Platform.Mac */
      ]: 103
    };
  }
});

// out-build/vs/server/node/extensionHostStatusService.js
var $LW, $MW;
var init_extensionHostStatusService = __esm({
  "out-build/vs/server/node/extensionHostStatusService.js"() {
    "use strict";
    init_instantiation();
    $LW = $Qk("extensionHostStatusService");
    $MW = class {
      constructor() {
        this.a = /* @__PURE__ */ new Map();
      }
      setExitInfo(reconnectionToken, info) {
        this.a.set(reconnectionToken, info);
      }
      getExitInfo(reconnectionToken) {
        return this.a.get(reconnectionToken) || null;
      }
    };
  }
});

// out-build/vs/workbench/services/extensions/common/extensionHostEnv.js
function clean2(env2) {
  delete env2[$RW.ENV_KEY];
  delete env2[$SW.ENV_KEY];
  delete env2[$TW.ENV_KEY];
}
function $UW(connection, env2) {
  clean2(env2);
  connection.serialize(env2);
}
var ExtHostConnectionType, $RW, $SW, $TW;
var init_extensionHostEnv = __esm({
  "out-build/vs/workbench/services/extensions/common/extensionHostEnv.js"() {
    "use strict";
    (function(ExtHostConnectionType2) {
      ExtHostConnectionType2[ExtHostConnectionType2["IPC"] = 1] = "IPC";
      ExtHostConnectionType2[ExtHostConnectionType2["Socket"] = 2] = "Socket";
      ExtHostConnectionType2[ExtHostConnectionType2["MessagePort"] = 3] = "MessagePort";
    })(ExtHostConnectionType || (ExtHostConnectionType = {}));
    $RW = class _$RW {
      static {
        this.ENV_KEY = "VSCODE_EXTHOST_IPC_HOOK";
      }
      constructor(pipeName) {
        this.pipeName = pipeName;
        this.type = 1;
      }
      serialize(env2) {
        env2[_$RW.ENV_KEY] = this.pipeName;
      }
    };
    $SW = class _$SW {
      constructor() {
        this.type = 2;
      }
      static {
        this.ENV_KEY = "VSCODE_EXTHOST_WILL_SEND_SOCKET";
      }
      serialize(env2) {
        env2[_$SW.ENV_KEY] = "1";
      }
    };
    $TW = class _$TW {
      constructor() {
        this.type = 3;
      }
      static {
        this.ENV_KEY = "VSCODE_WILL_SEND_MESSAGE_PORT";
      }
      serialize(env2) {
        env2[_$TW.ENV_KEY] = "1";
      }
    };
  }
});

// out-build/vs/server/node/extensionHostConnection.js
import * as cp from "child_process";
import * as net2 from "net";
async function $WW(startParamsEnv = {}, withUserShellEnvironment, language, environmentService, logService, configurationService) {
  const nlsConfig = await $NW(language, environmentService.userDataPath);
  let userShellEnv = {};
  if (withUserShellEnvironment) {
    try {
      userShellEnv = await $Vx(configurationService, logService, environmentService.args, process.env);
    } catch (error) {
      logService.error("ExtensionHostConnection#buildUserEnvironment resolving shell environment failed", error);
    }
  }
  const processEnv = process.env;
  const env2 = {
    ...processEnv,
    ...userShellEnv,
    ...{
      VSCODE_ESM_ENTRYPOINT: "vs/workbench/api/node/extensionHostProcess",
      VSCODE_HANDLES_UNCAUGHT_ERRORS: "true",
      VSCODE_NLS_CONFIG: JSON.stringify(nlsConfig)
    },
    ...startParamsEnv
  };
  const binFolder = environmentService.isBuilt ? $nc(environmentService.appRoot, "bin") : $nc(environmentService.appRoot, "resources", "server", "bin-dev");
  const remoteCliBinFolder = $nc(binFolder, "remote-cli");
  let PATH = readCaseInsensitive(env2, "PATH");
  if (PATH) {
    PATH = remoteCliBinFolder + $xc + PATH;
  } else {
    PATH = remoteCliBinFolder;
  }
  setCaseInsensitive(env2, "PATH", PATH);
  if (!environmentService.args["without-browser-env-var"]) {
    env2.BROWSER = $nc(binFolder, "helpers", $l ? "browser.cmd" : "browser.sh");
  }
  removeNulls(env2);
  return env2;
}
function readCaseInsensitive(env2, key) {
  const pathKeys = Object.keys(env2).filter((k) => k.toLowerCase() === key.toLowerCase());
  const pathKey = pathKeys.length > 0 ? pathKeys[0] : key;
  return env2[pathKey];
}
function setCaseInsensitive(env2, key, value) {
  const pathKeys = Object.keys(env2).filter((k) => k.toLowerCase() === key.toLowerCase());
  const pathKey = pathKeys.length > 0 ? pathKeys[0] : key;
  env2[pathKey] = value;
}
function removeNulls(env2) {
  for (const key of Object.keys(env2)) {
    if (env2[key] === null) {
      delete env2[key];
    }
  }
}
var ConnectionData, $XW;
var init_extensionHostConnection = __esm({
  "out-build/vs/server/node/extensionHostConnection.js"() {
    "use strict";
    init_buffer();
    init_event();
    init_lifecycle();
    init_network();
    init_path();
    init_platform();
    init_processes();
    init_ipc_net2();
    init_configuration();
    init_log();
    init_shellEnv();
    init_extensionHostStatusService();
    init_remoteLanguagePacks();
    init_serverEnvironmentService();
    init_extensionHostEnv();
    ConnectionData = class {
      constructor(socket, initialDataChunk) {
        this.socket = socket;
        this.initialDataChunk = initialDataChunk;
      }
      socketDrain() {
        return this.socket.drain();
      }
      toIExtHostSocketMessage() {
        let skipWebSocketFrames;
        let permessageDeflate;
        let inflateBytes;
        if (this.socket instanceof $uu) {
          skipWebSocketFrames = true;
          permessageDeflate = false;
          inflateBytes = $Ci.alloc(0);
        } else {
          skipWebSocketFrames = false;
          permessageDeflate = this.socket.permessageDeflate;
          inflateBytes = this.socket.recordedInflateBytes;
        }
        return {
          type: "VSCODE_EXTHOST_IPC_SOCKET",
          initialDataChunk: this.initialDataChunk.buffer.toString("base64"),
          skipWebSocketFrames,
          permessageDeflate,
          inflateBytes: inflateBytes.buffer.toString("base64")
        };
      }
    };
    $XW = class $XW2 extends $3c {
      constructor(m, remoteAddress, socket, initialDataChunk, n, r, s, t) {
        super();
        this.m = m;
        this.n = n;
        this.r = r;
        this.s = s;
        this.t = t;
        this.b = new $ze();
        this.onClose = this.b.event;
        this.c = (!$l || !this.n.args["socket-path"]) && !(this.n.args["cert"] && this.n.args["cert-key"]);
        this.f = false;
        this.g = remoteAddress;
        this.h = null;
        this.j = new ConnectionData(socket, initialDataChunk);
        this.w(`New connection established.`);
      }
      dispose() {
        this.D();
        super.dispose();
      }
      get u() {
        return `[${this.g}][${this.m.substr(0, 8)}][ExtensionHostConnection] `;
      }
      w(_str) {
        this.r.info(`${this.u}${_str}`);
      }
      y(_str) {
        this.r.error(`${this.u}${_str}`);
      }
      async z(extHostSocket, connectionData) {
        const disposables = new $2c();
        disposables.add(connectionData.socket);
        disposables.add($1c(() => {
          extHostSocket.destroy();
        }));
        const stopAndCleanup = () => {
          disposables.dispose();
        };
        disposables.add(connectionData.socket.onEnd(stopAndCleanup));
        disposables.add(connectionData.socket.onClose(stopAndCleanup));
        disposables.add(Event.fromNodeEventEmitter(extHostSocket, "end")(stopAndCleanup));
        disposables.add(Event.fromNodeEventEmitter(extHostSocket, "close")(stopAndCleanup));
        disposables.add(Event.fromNodeEventEmitter(extHostSocket, "error")(stopAndCleanup));
        disposables.add(connectionData.socket.onData((e) => extHostSocket.write(e.buffer)));
        disposables.add(Event.fromNodeEventEmitter(extHostSocket, "data")((e) => {
          connectionData.socket.write($Ci.wrap(e));
        }));
        if (connectionData.initialDataChunk.byteLength > 0) {
          extHostSocket.write(connectionData.initialDataChunk.buffer);
        }
      }
      async C(extensionHostProcess, connectionData) {
        await connectionData.socketDrain();
        const msg = connectionData.toIExtHostSocketMessage();
        let socket;
        if (connectionData.socket instanceof $uu) {
          socket = connectionData.socket.socket;
        } else {
          socket = connectionData.socket.socket.socket;
        }
        try {
          extensionHostProcess.send(msg, socket);
        } catch (error) {
          console.error("Error occurred while attempting to send socket to extension host");
          if (error) {
            console.error(error);
          }
        }
      }
      shortenReconnectionGraceTimeIfNecessary() {
        if (!this.h) {
          return;
        }
        const msg = {
          type: "VSCODE_EXTHOST_IPC_REDUCE_GRACE_TIME"
        };
        this.h.send(msg);
      }
      acceptReconnection(remoteAddress, _socket, initialDataChunk) {
        this.g = remoteAddress;
        this.w(`The client has reconnected.`);
        const connectionData = new ConnectionData(_socket, initialDataChunk);
        if (!this.h) {
          this.j = connectionData;
          return;
        }
        this.C(this.h, connectionData);
      }
      D() {
        if (this.f) {
          return;
        }
        this.f = true;
        if (this.j) {
          this.j.socket.end();
          this.j = null;
        }
        if (this.h) {
          this.h.kill();
          this.h = null;
        }
        this.b.fire(void 0);
      }
      async start(startParams) {
        try {
          let execArgv = process.execArgv ? process.execArgv.filter((a) => !/^--inspect(-brk)?=/.test(a)) : [];
          if (startParams.port && !process.pkg) {
            execArgv = [`--inspect${startParams.break ? "-brk" : ""}=${startParams.port}`];
          }
          const env2 = await $WW(startParams.env, true, startParams.language, this.n, this.r, this.t);
          $Fx(env2);
          let extHostNamedPipeServer;
          if (this.c) {
            $UW(new $SW(), env2);
            extHostNamedPipeServer = null;
          } else {
            const { namedPipeServer, pipeName } = await this.F();
            $UW(new $RW(pipeName), env2);
            extHostNamedPipeServer = namedPipeServer;
          }
          const opts = {
            env: env2,
            execArgv,
            silent: true
          };
          opts.execArgv.unshift("--dns-result-order=ipv4first");
          const args = ["--type=extensionHost", `--transformURIs`];
          const useHostProxy = this.n.args["use-host-proxy"];
          args.push(`--useHostProxy=${useHostProxy ? "true" : "false"}`);
          this.h = cp.fork($ih.asFileUri("bootstrap-fork").fsPath, args, opts);
          const pid = this.h.pid;
          this.w(`<${pid}> Launched Extension Host Process.`);
          this.h.stdout.setEncoding("utf8");
          this.h.stderr.setEncoding("utf8");
          const onStdout = Event.fromNodeEventEmitter(this.h.stdout, "data");
          const onStderr = Event.fromNodeEventEmitter(this.h.stderr, "data");
          this.B(onStdout((e) => this.w(`<${pid}> ${e}`)));
          this.B(onStderr((e) => this.w(`<${pid}><stderr> ${e}`)));
          this.h.on("error", (err) => {
            this.y(`<${pid}> Extension Host Process had an error`);
            this.r.error(err);
            this.D();
          });
          this.h.on("exit", (code, signal) => {
            this.s.setExitInfo(this.m, { code, signal });
            this.w(`<${pid}> Extension Host Process exited with code: ${code}, signal: ${signal}.`);
            this.D();
          });
          if (extHostNamedPipeServer) {
            extHostNamedPipeServer.on("connection", (socket) => {
              extHostNamedPipeServer.close();
              this.z(socket, this.j);
            });
          } else {
            const messageListener = (msg) => {
              if (msg.type === "VSCODE_EXTHOST_IPC_READY") {
                this.h.removeListener("message", messageListener);
                this.C(this.h, this.j);
                this.j = null;
              }
            };
            this.h.on("message", messageListener);
          }
        } catch (error) {
          console.error("ExtensionHostConnection errored");
          if (error) {
            console.error(error);
          }
        }
      }
      F() {
        return new Promise((resolve4, reject) => {
          const pipeName = $xu();
          const namedPipeServer = net2.createServer();
          namedPipeServer.on("error", reject);
          namedPipeServer.listen(pipeName, () => {
            namedPipeServer?.removeListener("error", reject);
            resolve4({ pipeName, namedPipeServer });
          });
        });
      }
    };
    $XW = __decorate([
      __param(4, $PW),
      __param(5, $wn),
      __param(6, $LW),
      __param(7, $kl)
    ], $XW);
  }
});

// out-build/vs/server/node/remoteExtensionManagement.js
function printTime(ms) {
  let h = 0;
  let m = 0;
  let s = 0;
  if (ms >= 1e3) {
    s = Math.floor(ms / 1e3);
    ms -= s * 1e3;
  }
  if (s >= 60) {
    m = Math.floor(s / 60);
    s -= m * 60;
  }
  if (m >= 60) {
    h = Math.floor(m / 60);
    m -= h * 60;
  }
  const _h = h ? `${h}h` : ``;
  const _m = m ? `${m}m` : ``;
  const _s = s ? `${s}s` : ``;
  const _ms = ms ? `${ms}ms` : ``;
  return `${_h}${_m}${_s}${_ms}`;
}
var $YW;
var init_remoteExtensionManagement = __esm({
  "out-build/vs/server/node/remoteExtensionManagement.js"() {
    "use strict";
    init_event();
    init_async();
    $YW = class {
      constructor(i, j, remoteAddress, protocol) {
        this.i = i;
        this.j = j;
        this.a = new $ze();
        this.onClose = this.a.event;
        this.b = 108e5;
        this.c = 3e5;
        this.d = remoteAddress;
        this.protocol = protocol;
        this.e = false;
        this.f = new $9h(() => {
          this.k(`The reconnection grace time of ${printTime(this.b)} has expired, so the connection will be disposed.`);
          this.l();
        }, this.b);
        this.g = new $9h(() => {
          this.k(`The reconnection short grace time of ${printTime(this.c)} has expired, so the connection will be disposed.`);
          this.l();
        }, this.c);
        this.protocol.onDidDispose(() => {
          this.k(`The client has disconnected gracefully, so the connection will be disposed.`);
          this.l();
        });
        this.protocol.onSocketClose(() => {
          this.k(`The client has disconnected, will wait for reconnection ${printTime(this.b)} before disposing...`);
          this.f.schedule();
        });
        this.k(`New connection established.`);
      }
      k(_str) {
        this.i.info(`[${this.d}][${this.j.substr(0, 8)}][ManagementConnection] ${_str}`);
      }
      shortenReconnectionGraceTimeIfNecessary() {
        if (this.g.isScheduled()) {
          return;
        }
        if (this.f.isScheduled()) {
          this.k(`Another client has connected, will shorten the wait for reconnection ${printTime(this.c)} before disposing...`);
          this.g.schedule();
        }
      }
      l() {
        if (this.e) {
          return;
        }
        this.e = true;
        this.f.dispose();
        this.g.dispose();
        const socket = this.protocol.getSocket();
        this.protocol.sendDisconnect();
        this.protocol.dispose();
        socket.end();
        this.a.fire(void 0);
      }
      acceptReconnection(remoteAddress, socket, initialDataChunk) {
        this.d = remoteAddress;
        this.k(`The client has reconnected.`);
        this.f.cancel();
        this.g.cancel();
        this.protocol.beginAcceptReconnection(socket, initialDataChunk);
        this.protocol.endAcceptReconnection();
      }
    };
  }
});

// out-build/vs/server/node/serverConnectionToken.js
import * as cookie from "cookie";
import * as fs8 from "fs";
async function $3W(args, defaultValue) {
  const withoutConnectionToken = args["without-connection-token"];
  const connectionToken = args["connection-token"];
  const connectionTokenFile = args["connection-token-file"];
  if (withoutConnectionToken) {
    if (typeof connectionToken !== "undefined" || typeof connectionTokenFile !== "undefined") {
      return new $2W(`Please do not use the argument '--connection-token' or '--connection-token-file' at the same time as '--without-connection-token'.`);
    }
    return new $ZW();
  }
  if (typeof connectionTokenFile !== "undefined") {
    if (typeof connectionToken !== "undefined") {
      return new $2W(`Please do not use the argument '--connection-token' at the same time as '--connection-token-file'.`);
    }
    let rawConnectionToken;
    try {
      rawConnectionToken = fs8.readFileSync(connectionTokenFile).toString().replace(/\r?\n$/, "");
    } catch (e) {
      return new $2W(`Unable to read the connection token file at '${connectionTokenFile}'.`);
    }
    if (!connectionTokenRegex.test(rawConnectionToken)) {
      return new $2W(`The connection token defined in '${connectionTokenFile} does not adhere to the characters 0-9, a-z, A-Z, _, or -.`);
    }
    return new $1W(rawConnectionToken);
  }
  if (typeof connectionToken !== "undefined") {
    if (!connectionTokenRegex.test(connectionToken)) {
      return new $2W(`The connection token '${connectionToken} does not adhere to the characters 0-9, a-z, A-Z or -.`);
    }
    return new $1W(connectionToken);
  }
  return new $1W(await defaultValue());
}
async function $4W(args) {
  const readOrGenerateConnectionToken = async () => {
    if (!args["user-data-dir"]) {
      return $ps();
    }
    const storageLocation = $nc(args["user-data-dir"], "token");
    try {
      const fileContents = await fs8.promises.readFile(storageLocation);
      const connectionToken2 = fileContents.toString().replace(/\r?\n$/, "");
      if (connectionTokenRegex.test(connectionToken2)) {
        return connectionToken2;
      }
    } catch (err) {
    }
    const connectionToken = $ps();
    try {
      await Promises2.writeFile(storageLocation, connectionToken, { mode: 384 });
    } catch (err) {
    }
    return connectionToken;
  };
  return $3W(args, readOrGenerateConnectionToken);
}
function $5W(connectionToken, req, parsedUrl) {
  if (connectionToken.validate(parsedUrl.query[$ah])) {
    return true;
  }
  const cookies = cookie.parse(req.headers.cookie || "");
  return connectionToken.validate(cookies[$_g]);
}
var connectionTokenRegex, ServerConnectionTokenType, $ZW, $1W, $2W;
var init_serverConnectionToken = __esm({
  "out-build/vs/server/node/serverConnectionToken.js"() {
    "use strict";
    init_path();
    init_uuid();
    init_network();
    init_pfs();
    connectionTokenRegex = /^[0-9A-Za-z_-]+$/;
    (function(ServerConnectionTokenType2) {
      ServerConnectionTokenType2[ServerConnectionTokenType2["None"] = 0] = "None";
      ServerConnectionTokenType2[ServerConnectionTokenType2["Optional"] = 1] = "Optional";
      ServerConnectionTokenType2[ServerConnectionTokenType2["Mandatory"] = 2] = "Mandatory";
    })(ServerConnectionTokenType || (ServerConnectionTokenType = {}));
    $ZW = class {
      constructor() {
        this.type = 0;
      }
      validate(connectionToken) {
        return true;
      }
    };
    $1W = class {
      constructor(value) {
        this.value = value;
        this.type = 2;
      }
      validate(connectionToken) {
        return connectionToken === this.value;
      }
    };
    $2W = class {
      constructor(message) {
        this.message = message;
      }
    };
  }
});

// out-build/vs/base/node/macAddress.js
import { networkInterfaces } from "os";
function validateMacAddress(candidate) {
  const tempCandidate = candidate.replace(/\-/g, ":").toLowerCase();
  return !invalidMacAddresses.has(tempCandidate);
}
function $Dy() {
  const ifaces = networkInterfaces();
  for (const name in ifaces) {
    const networkInterface = ifaces[name];
    if (networkInterface) {
      for (const { mac } of networkInterface) {
        if (validateMacAddress(mac)) {
          return mac;
        }
      }
    }
  }
  throw new Error("Unable to retrieve mac address (unexpected format)");
}
var invalidMacAddresses;
var init_macAddress = __esm({
  "out-build/vs/base/node/macAddress.js"() {
    "use strict";
    invalidMacAddresses = /* @__PURE__ */ new Set([
      "00:00:00:00:00:00",
      "ff:ff:ff:ff:ff:ff",
      "ac:de:48:00:11:22"
    ]);
  }
});

// out-build/vs/base/node/id.js
import { networkInterfaces as networkInterfaces2 } from "os";
async function $Fy(errorLogger) {
  if (!machineId) {
    machineId = (async () => {
      const id2 = await getMacMachineId(errorLogger);
      return id2 || $ps();
    })();
  }
  return machineId;
}
async function getMacMachineId(errorLogger) {
  try {
    const crypto4 = await import("crypto");
    const macAddress = $Dy();
    return crypto4.createHash("sha256").update(macAddress, "utf8").digest("hex");
  } catch (err) {
    errorLogger(err);
    return void 0;
  }
}
async function $Gy(errorLogger) {
  if ($l) {
    const Registry = await import("@vscode/windows-registry");
    try {
      return Registry.GetStringRegKey("HKEY_LOCAL_MACHINE", SQM_KEY, "MachineId") || "";
    } catch (err) {
      errorLogger(err);
      return "";
    }
  }
  return "";
}
async function $Hy(errorLogger) {
  try {
    const deviceIdPackage = await import("@vscode/deviceid");
    const id2 = await deviceIdPackage.getDeviceId();
    return id2;
  } catch (err) {
    errorLogger(err);
    return $ps();
  }
}
var $Ey, machineId, SQM_KEY;
var init_id = __esm({
  "out-build/vs/base/node/id.js"() {
    "use strict";
    init_ternarySearchTree();
    init_uuid();
    init_macAddress();
    init_platform();
    $Ey = new class {
      c(mac) {
        if (!this.a) {
          this.a = $Wk.forStrings();
          this.a.set("00-50-56", true);
          this.a.set("00-0C-29", true);
          this.a.set("00-05-69", true);
          this.a.set("00-03-FF", true);
          this.a.set("00-1C-42", true);
          this.a.set("00-16-3E", true);
          this.a.set("08-00-27", true);
          this.a.set("00:50:56", true);
          this.a.set("00:0C:29", true);
          this.a.set("00:05:69", true);
          this.a.set("00:03:FF", true);
          this.a.set("00:1C:42", true);
          this.a.set("00:16:3E", true);
          this.a.set("08:00:27", true);
        }
        return !!this.a.findSubstr(mac);
      }
      value() {
        if (this.b === void 0) {
          let vmOui = 0;
          let interfaceCount = 0;
          const interfaces = networkInterfaces2();
          for (const name in interfaces) {
            const networkInterface = interfaces[name];
            if (networkInterface) {
              for (const { mac, internal } of networkInterface) {
                if (!internal) {
                  interfaceCount += 1;
                  if (this.c(mac.toUpperCase())) {
                    vmOui += 1;
                  }
                }
              }
            }
          }
          this.b = interfaceCount > 0 ? vmOui / interfaceCount : 0;
        }
        return this.b;
      }
    }();
    SQM_KEY = "Software\\Microsoft\\SQMClient";
  }
});

// out-build/vs/platform/debug/common/extensionHostDebugIpc.js
var $Bx;
var init_extensionHostDebugIpc = __esm({
  "out-build/vs/platform/debug/common/extensionHostDebugIpc.js"() {
    "use strict";
    init_event();
    init_lifecycle();
    $Bx = class {
      constructor() {
        this.a = new $ze();
        this.b = new $ze();
        this.c = new $ze();
        this.d = new $ze();
      }
      static {
        this.ChannelName = "extensionhostdebugservice";
      }
      call(ctx, command, arg) {
        switch (command) {
          case "close":
            return Promise.resolve(this.a.fire({ sessionId: arg[0] }));
          case "reload":
            return Promise.resolve(this.b.fire({ sessionId: arg[0] }));
          case "terminate":
            return Promise.resolve(this.c.fire({ sessionId: arg[0] }));
          case "attach":
            return Promise.resolve(this.d.fire({ sessionId: arg[0], port: arg[1], subId: arg[2] }));
        }
        throw new Error("Method not implemented.");
      }
      listen(ctx, event, arg) {
        switch (event) {
          case "close":
            return this.a.event;
          case "reload":
            return this.b.event;
          case "terminate":
            return this.c.event;
          case "attach":
            return this.d.event;
        }
        throw new Error("Method not implemented.");
      }
    };
  }
});

// out-build/vs/platform/download/common/downloadIpc.js
var $8W;
var init_downloadIpc = __esm({
  "out-build/vs/platform/download/common/downloadIpc.js"() {
    "use strict";
    init_uri();
    $8W = class {
      constructor(a, b) {
        this.a = a;
        this.b = b;
      }
      async download(from, to) {
        const uriTransformer = this.b();
        if (uriTransformer) {
          from = uriTransformer.transformOutgoingURI(from);
          to = uriTransformer.transformOutgoingURI(to);
        }
        await this.a.call("download", [from, to]);
      }
    };
  }
});

// out-build/vs/base/common/uriIpc.js
function toJSON(uri) {
  return uri.toJSON();
}
function _transformOutgoingURIs(obj, transformer, depth) {
  if (!obj || depth > 200) {
    return null;
  }
  if (typeof obj === "object") {
    if (obj instanceof URI) {
      return transformer.transformOutgoing(obj);
    }
    for (const key in obj) {
      if (Object.hasOwnProperty.call(obj, key)) {
        const r = _transformOutgoingURIs(obj[key], transformer, depth + 1);
        if (r !== null) {
          obj[key] = r;
        }
      }
    }
  }
  return null;
}
function $ty(obj, transformer) {
  const result = _transformOutgoingURIs(obj, transformer, 0);
  if (result === null) {
    return obj;
  }
  return result;
}
function _transformIncomingURIs(obj, transformer, revive, depth) {
  if (!obj || depth > 200) {
    return null;
  }
  if (typeof obj === "object") {
    if (obj.$mid === 1) {
      return revive ? URI.revive(transformer.transformIncoming(obj)) : transformer.transformIncoming(obj);
    }
    if (obj instanceof $Ci) {
      return null;
    }
    for (const key in obj) {
      if (Object.hasOwnProperty.call(obj, key)) {
        const r = _transformIncomingURIs(obj[key], transformer, revive, depth + 1);
        if (r !== null) {
          obj[key] = r;
        }
      }
    }
  }
  return null;
}
function $uy(obj, transformer) {
  const result = _transformIncomingURIs(obj, transformer, false, 0);
  if (result === null) {
    return obj;
  }
  return result;
}
function $vy(obj, transformer) {
  const result = _transformIncomingURIs(obj, transformer, true, 0);
  if (result === null) {
    return obj;
  }
  return result;
}
var $ry, $sy;
var init_uriIpc = __esm({
  "out-build/vs/base/common/uriIpc.js"() {
    "use strict";
    init_buffer();
    init_uri();
    $ry = class {
      constructor(uriTransformer) {
        this.a = uriTransformer;
      }
      transformIncoming(uri) {
        const result = this.a.transformIncoming(uri);
        return result === uri ? uri : toJSON(URI.from(result));
      }
      transformOutgoing(uri) {
        const result = this.a.transformOutgoing(uri);
        return result === uri ? uri : toJSON(URI.from(result));
      }
      transformOutgoingURI(uri) {
        const result = this.a.transformOutgoing(uri);
        return result === uri ? uri : URI.from(result);
      }
      transformOutgoingScheme(scheme) {
        return this.a.transformOutgoingScheme(scheme);
      }
    };
    $sy = new class {
      transformIncoming(uri) {
        return uri;
      }
      transformOutgoing(uri) {
        return uri;
      }
      transformOutgoingURI(uri) {
        return uri;
      }
      transformOutgoingScheme(scheme) {
        return scheme;
      }
    }();
  }
});

// out-build/vs/platform/extensionManagement/common/extensionManagementIpc.js
function transformIncomingURI(uri, transformer) {
  return uri ? URI.revive(transformer ? transformer.transformIncoming(uri) : uri) : void 0;
}
function transformOutgoingURI(uri, transformer) {
  return transformer ? transformer.transformOutgoingURI(uri) : uri;
}
function transformIncomingExtension(extension, transformer) {
  transformer = transformer ? transformer : $sy;
  const manifest = extension.manifest;
  const transformed = $vy({ ...extension, ...{ manifest: void 0 } }, transformer);
  return { ...transformed, ...{ manifest } };
}
function transformIncomingOptions(options2, transformer) {
  return options2?.profileLocation ? $vy(options2, transformer ?? $sy) : options2;
}
function transformOutgoingExtension(extension, transformer) {
  return transformer ? $Nv(extension, (value) => value instanceof URI ? transformer.transformOutgoingURI(value) : void 0) : extension;
}
var $gX;
var init_extensionManagementIpc = __esm({
  "out-build/vs/platform/extensionManagement/common/extensionManagementIpc.js"() {
    "use strict";
    init_event();
    init_objects();
    init_uri();
    init_uriIpc();
    init_abstractExtensionManagementService();
    $gX = class {
      constructor(a, b) {
        this.a = a;
        this.b = b;
        this.onInstallExtension = Event.buffer(a.onInstallExtension, true);
        this.onDidInstallExtensions = Event.buffer(a.onDidInstallExtensions, true);
        this.onUninstallExtension = Event.buffer(a.onUninstallExtension, true);
        this.onDidUninstallExtension = Event.buffer(a.onDidUninstallExtension, true);
        this.onDidUpdateExtensionMetadata = Event.buffer(a.onDidUpdateExtensionMetadata, true);
      }
      listen(context, event) {
        const uriTransformer = this.b(context);
        switch (event) {
          case "onInstallExtension": {
            return Event.map(this.onInstallExtension, (e) => {
              return {
                ...e,
                profileLocation: e.profileLocation ? transformOutgoingURI(e.profileLocation, uriTransformer) : e.profileLocation
              };
            });
          }
          case "onDidInstallExtensions": {
            return Event.map(this.onDidInstallExtensions, (results) => results.map((i) => ({
              ...i,
              local: i.local ? transformOutgoingExtension(i.local, uriTransformer) : i.local,
              profileLocation: i.profileLocation ? transformOutgoingURI(i.profileLocation, uriTransformer) : i.profileLocation
            })));
          }
          case "onUninstallExtension": {
            return Event.map(this.onUninstallExtension, (e) => {
              return {
                ...e,
                profileLocation: e.profileLocation ? transformOutgoingURI(e.profileLocation, uriTransformer) : e.profileLocation
              };
            });
          }
          case "onDidUninstallExtension": {
            return Event.map(this.onDidUninstallExtension, (e) => {
              return {
                ...e,
                profileLocation: e.profileLocation ? transformOutgoingURI(e.profileLocation, uriTransformer) : e.profileLocation
              };
            });
          }
          case "onDidUpdateExtensionMetadata": {
            return Event.map(this.onDidUpdateExtensionMetadata, (e) => {
              return {
                local: transformOutgoingExtension(e.local, uriTransformer),
                profileLocation: transformOutgoingURI(e.profileLocation, uriTransformer)
              };
            });
          }
        }
        throw new Error("Invalid listen");
      }
      async call(context, command, args) {
        const uriTransformer = this.b(context);
        switch (command) {
          case "zip": {
            const extension = transformIncomingExtension(args[0], uriTransformer);
            const uri = await this.a.zip(extension);
            return transformOutgoingURI(uri, uriTransformer);
          }
          case "install": {
            return this.a.install(transformIncomingURI(args[0], uriTransformer), transformIncomingOptions(args[1], uriTransformer));
          }
          case "installFromLocation": {
            return this.a.installFromLocation(transformIncomingURI(args[0], uriTransformer), transformIncomingURI(args[1], uriTransformer));
          }
          case "installExtensionsFromProfile": {
            return this.a.installExtensionsFromProfile(args[0], transformIncomingURI(args[1], uriTransformer), transformIncomingURI(args[2], uriTransformer));
          }
          case "getManifest": {
            return this.a.getManifest(transformIncomingURI(args[0], uriTransformer));
          }
          case "getTargetPlatform": {
            return this.a.getTargetPlatform();
          }
          case "installFromGallery": {
            return this.a.installFromGallery(args[0], transformIncomingOptions(args[1], uriTransformer));
          }
          case "installGalleryExtensions": {
            const arg = args[0];
            return this.a.installGalleryExtensions(arg.map(({ extension, options: options2 }) => ({ extension, options: transformIncomingOptions(options2, uriTransformer) ?? {} })));
          }
          case "uninstall": {
            return this.a.uninstall(transformIncomingExtension(args[0], uriTransformer), transformIncomingOptions(args[1], uriTransformer));
          }
          case "uninstallExtensions": {
            const arg = args[0];
            return this.a.uninstallExtensions(arg.map(({ extension, options: options2 }) => ({ extension: transformIncomingExtension(extension, uriTransformer), options: transformIncomingOptions(options2, uriTransformer) })));
          }
          case "reinstallFromGallery": {
            return this.a.reinstallFromGallery(transformIncomingExtension(args[0], uriTransformer));
          }
          case "getInstalled": {
            const extensions = await this.a.getInstalled(args[0], transformIncomingURI(args[1], uriTransformer), args[2]);
            return extensions.map((e) => transformOutgoingExtension(e, uriTransformer));
          }
          case "toggleAppliationScope": {
            const extension = await this.a.toggleAppliationScope(transformIncomingExtension(args[0], uriTransformer), transformIncomingURI(args[1], uriTransformer));
            return transformOutgoingExtension(extension, uriTransformer);
          }
          case "copyExtensions": {
            return this.a.copyExtensions(transformIncomingURI(args[0], uriTransformer), transformIncomingURI(args[1], uriTransformer));
          }
          case "updateMetadata": {
            const e = await this.a.updateMetadata(transformIncomingExtension(args[0], uriTransformer), args[1], transformIncomingURI(args[2], uriTransformer));
            return transformOutgoingExtension(e, uriTransformer);
          }
          case "resetPinnedStateForAllUserExtensions": {
            return this.a.resetPinnedStateForAllUserExtensions(args[0]);
          }
          case "getExtensionsControlManifest": {
            return this.a.getExtensionsControlManifest();
          }
          case "download": {
            return this.a.download(args[0], args[1], args[2]);
          }
          case "cleanUp": {
            return this.a.cleanUp();
          }
        }
        throw new Error("Invalid call");
      }
    };
  }
});

// out-build/vs/platform/request/common/requestIpc.js
var $BX;
var init_requestIpc = __esm({
  "out-build/vs/platform/request/common/requestIpc.js"() {
    "use strict";
    init_buffer();
    init_cancellation();
    $BX = class {
      constructor(a) {
        this.a = a;
      }
      listen(context, event) {
        throw new Error("Invalid listen");
      }
      call(context, command, args, token = CancellationToken.None) {
        switch (command) {
          case "request":
            return this.a.request(args[0], token).then(async ({ res, stream }) => {
              const buffer = await $Oi(stream);
              return [{ statusCode: res.statusCode, headers: res.headers }, buffer];
            });
          case "resolveProxy":
            return this.a.resolveProxy(args[0]);
          case "lookupAuthorization":
            return this.a.lookupAuthorization(args[0]);
          case "lookupKerberosAuthorization":
            return this.a.lookupKerberosAuthorization(args[0]);
          case "loadCertificates":
            return this.a.loadCertificates();
        }
        throw new Error("Invalid call");
      }
    };
  }
});

// out-build/vs/platform/telemetry/common/errorTelemetry.js
var ErrorEvent, $DX;
var init_errorTelemetry = __esm({
  "out-build/vs/platform/telemetry/common/errorTelemetry.js"() {
    "use strict";
    init_arrays();
    init_errors();
    init_lifecycle();
    init_objects();
    init_files();
    (function(ErrorEvent2) {
      function compare3(a, b) {
        if (a.callstack < b.callstack) {
          return -1;
        } else if (a.callstack > b.callstack) {
          return 1;
        }
        return 0;
      }
      ErrorEvent2.compare = compare3;
    })(ErrorEvent || (ErrorEvent = {}));
    $DX = class _$DX {
      static {
        this.ERROR_FLUSH_TIMEOUT = 5 * 1e3;
      }
      constructor(telemetryService, flushDelay = _$DX.ERROR_FLUSH_TIMEOUT) {
        this.f = -1;
        this.g = [];
        this.h = new $2c();
        this.c = telemetryService;
        this.d = flushDelay;
        const unbind = $cb.addListener((err) => this.j(err));
        this.h.add($1c(unbind));
        this.i();
      }
      dispose() {
        clearTimeout(this.f);
        this.l();
        this.h.dispose();
      }
      i() {
      }
      j(err) {
        if (!err || err.code) {
          return;
        }
        if (err.detail && err.detail.stack) {
          err = err.detail;
        }
        if ($ub.isErrorNoTelemetry(err) || err instanceof $Fm || typeof err?.message === "string" && err.message.includes("Unable to read file")) {
          return;
        }
        const callstack = Array.isArray(err.stack) ? err.stack.join("\n") : err.stack;
        const msg = err.message ? err.message : $Qv(err);
        if (!callstack) {
          return;
        }
        this.k({ msg, callstack });
      }
      k(e) {
        const idx = $Bb(this.g, e, ErrorEvent.compare);
        if (idx < 0) {
          e.count = 1;
          this.g.splice(~idx, 0, e);
        } else {
          if (!this.g[idx].count) {
            this.g[idx].count = 0;
          }
          this.g[idx].count += 1;
        }
        if (this.f === -1) {
          this.f = setTimeout(() => {
            this.l();
            this.f = -1;
          }, this.d);
        }
      }
      l() {
        for (const error of this.g) {
          this.c.publicLogError2("UnhandledError", error);
        }
        this.g.length = 0;
      }
    };
  }
});

// out-build/vs/platform/telemetry/node/errorTelemetry.js
var $EX;
var init_errorTelemetry2 = __esm({
  "out-build/vs/platform/telemetry/node/errorTelemetry.js"() {
    "use strict";
    init_errors();
    init_errorTelemetry();
    $EX = class extends $DX {
      i() {
        setUnexpectedErrorHandler((err) => console.error(err));
        const unhandledPromises = [];
        process.on("unhandledRejection", (reason, promise) => {
          unhandledPromises.push(promise);
          setTimeout(() => {
            const idx = unhandledPromises.indexOf(promise);
            if (idx >= 0) {
              promise.catch((e) => {
                unhandledPromises.splice(idx, 1);
                if (!$kb(e)) {
                  console.warn(`rejected promise not handled within 1 second: ${e}`);
                  if (e.stack) {
                    console.warn(`stack trace: ${e.stack}`);
                  }
                  if (reason) {
                    $gb(reason);
                  }
                }
              });
            }
          }, 1e3);
        });
        process.on("rejectionHandled", (promise) => {
          const idx = unhandledPromises.indexOf(promise);
          if (idx >= 0) {
            unhandledPromises.splice(idx, 1);
          }
        });
        process.on("uncaughtException", (err) => {
          if ($eb(err)) {
            return;
          }
          $gb(err);
        });
      }
    };
  }
});

// out-build/vs/platform/terminal/common/terminal.js
var $4x, TerminalSettingPrefix, TerminalSettingId, PosixShellType, WindowsShellType, GeneralShellType, TitleEventSource, TerminalIpcChannels, ProcessPropertyType, $5x, HeartbeatConstants, TerminalLocation, TerminalLocationString, LocalReconnectConstants, FlowControlConstants, ProfileSource, ShellIntegrationStatus, TerminalExitReason, $6x, TerminalBackendRegistry, $7x, $8x;
var init_terminal = __esm({
  "out-build/vs/platform/terminal/common/terminal.js"() {
    "use strict";
    init_instantiation();
    init_contextkey();
    init_platform2();
    $4x = new $nn("terminalTabFocusMode", false, true);
    (function(TerminalSettingPrefix2) {
      TerminalSettingPrefix2["AutomationProfile"] = "terminal.integrated.automationProfile.";
      TerminalSettingPrefix2["DefaultProfile"] = "terminal.integrated.defaultProfile.";
      TerminalSettingPrefix2["Profiles"] = "terminal.integrated.profiles.";
    })(TerminalSettingPrefix || (TerminalSettingPrefix = {}));
    (function(TerminalSettingId2) {
      TerminalSettingId2["SendKeybindingsToShell"] = "terminal.integrated.sendKeybindingsToShell";
      TerminalSettingId2["AutomationProfileLinux"] = "terminal.integrated.automationProfile.linux";
      TerminalSettingId2["AutomationProfileMacOs"] = "terminal.integrated.automationProfile.osx";
      TerminalSettingId2["AutomationProfileWindows"] = "terminal.integrated.automationProfile.windows";
      TerminalSettingId2["ProfilesWindows"] = "terminal.integrated.profiles.windows";
      TerminalSettingId2["ProfilesMacOs"] = "terminal.integrated.profiles.osx";
      TerminalSettingId2["ProfilesLinux"] = "terminal.integrated.profiles.linux";
      TerminalSettingId2["DefaultProfileLinux"] = "terminal.integrated.defaultProfile.linux";
      TerminalSettingId2["DefaultProfileMacOs"] = "terminal.integrated.defaultProfile.osx";
      TerminalSettingId2["DefaultProfileWindows"] = "terminal.integrated.defaultProfile.windows";
      TerminalSettingId2["UseWslProfiles"] = "terminal.integrated.useWslProfiles";
      TerminalSettingId2["TabsDefaultColor"] = "terminal.integrated.tabs.defaultColor";
      TerminalSettingId2["TabsDefaultIcon"] = "terminal.integrated.tabs.defaultIcon";
      TerminalSettingId2["TabsEnabled"] = "terminal.integrated.tabs.enabled";
      TerminalSettingId2["TabsEnableAnimation"] = "terminal.integrated.tabs.enableAnimation";
      TerminalSettingId2["TabsHideCondition"] = "terminal.integrated.tabs.hideCondition";
      TerminalSettingId2["TabsShowActiveTerminal"] = "terminal.integrated.tabs.showActiveTerminal";
      TerminalSettingId2["TabsShowActions"] = "terminal.integrated.tabs.showActions";
      TerminalSettingId2["TabsLocation"] = "terminal.integrated.tabs.location";
      TerminalSettingId2["TabsFocusMode"] = "terminal.integrated.tabs.focusMode";
      TerminalSettingId2["MacOptionIsMeta"] = "terminal.integrated.macOptionIsMeta";
      TerminalSettingId2["MacOptionClickForcesSelection"] = "terminal.integrated.macOptionClickForcesSelection";
      TerminalSettingId2["AltClickMovesCursor"] = "terminal.integrated.altClickMovesCursor";
      TerminalSettingId2["CopyOnSelection"] = "terminal.integrated.copyOnSelection";
      TerminalSettingId2["EnableMultiLinePasteWarning"] = "terminal.integrated.enableMultiLinePasteWarning";
      TerminalSettingId2["DrawBoldTextInBrightColors"] = "terminal.integrated.drawBoldTextInBrightColors";
      TerminalSettingId2["FontFamily"] = "terminal.integrated.fontFamily";
      TerminalSettingId2["FontSize"] = "terminal.integrated.fontSize";
      TerminalSettingId2["LetterSpacing"] = "terminal.integrated.letterSpacing";
      TerminalSettingId2["LineHeight"] = "terminal.integrated.lineHeight";
      TerminalSettingId2["MinimumContrastRatio"] = "terminal.integrated.minimumContrastRatio";
      TerminalSettingId2["TabStopWidth"] = "terminal.integrated.tabStopWidth";
      TerminalSettingId2["FastScrollSensitivity"] = "terminal.integrated.fastScrollSensitivity";
      TerminalSettingId2["MouseWheelScrollSensitivity"] = "terminal.integrated.mouseWheelScrollSensitivity";
      TerminalSettingId2["BellDuration"] = "terminal.integrated.bellDuration";
      TerminalSettingId2["FontWeight"] = "terminal.integrated.fontWeight";
      TerminalSettingId2["FontWeightBold"] = "terminal.integrated.fontWeightBold";
      TerminalSettingId2["CursorBlinking"] = "terminal.integrated.cursorBlinking";
      TerminalSettingId2["CursorStyle"] = "terminal.integrated.cursorStyle";
      TerminalSettingId2["CursorStyleInactive"] = "terminal.integrated.cursorStyleInactive";
      TerminalSettingId2["CursorWidth"] = "terminal.integrated.cursorWidth";
      TerminalSettingId2["Scrollback"] = "terminal.integrated.scrollback";
      TerminalSettingId2["DetectLocale"] = "terminal.integrated.detectLocale";
      TerminalSettingId2["DefaultLocation"] = "terminal.integrated.defaultLocation";
      TerminalSettingId2["GpuAcceleration"] = "terminal.integrated.gpuAcceleration";
      TerminalSettingId2["TerminalTitleSeparator"] = "terminal.integrated.tabs.separator";
      TerminalSettingId2["TerminalTitle"] = "terminal.integrated.tabs.title";
      TerminalSettingId2["TerminalDescription"] = "terminal.integrated.tabs.description";
      TerminalSettingId2["RightClickBehavior"] = "terminal.integrated.rightClickBehavior";
      TerminalSettingId2["MiddleClickBehavior"] = "terminal.integrated.middleClickBehavior";
      TerminalSettingId2["Cwd"] = "terminal.integrated.cwd";
      TerminalSettingId2["ConfirmOnExit"] = "terminal.integrated.confirmOnExit";
      TerminalSettingId2["ConfirmOnKill"] = "terminal.integrated.confirmOnKill";
      TerminalSettingId2["EnableBell"] = "terminal.integrated.enableBell";
      TerminalSettingId2["EnableVisualBell"] = "terminal.integrated.enableVisualBell";
      TerminalSettingId2["CommandsToSkipShell"] = "terminal.integrated.commandsToSkipShell";
      TerminalSettingId2["AllowChords"] = "terminal.integrated.allowChords";
      TerminalSettingId2["AllowMnemonics"] = "terminal.integrated.allowMnemonics";
      TerminalSettingId2["TabFocusMode"] = "terminal.integrated.tabFocusMode";
      TerminalSettingId2["EnvMacOs"] = "terminal.integrated.env.osx";
      TerminalSettingId2["EnvLinux"] = "terminal.integrated.env.linux";
      TerminalSettingId2["EnvWindows"] = "terminal.integrated.env.windows";
      TerminalSettingId2["EnvironmentChangesIndicator"] = "terminal.integrated.environmentChangesIndicator";
      TerminalSettingId2["EnvironmentChangesRelaunch"] = "terminal.integrated.environmentChangesRelaunch";
      TerminalSettingId2["ExperimentalWindowsUseConptyDll"] = "terminal.integrated.experimental.windowsUseConptyDll";
      TerminalSettingId2["ShowExitAlert"] = "terminal.integrated.showExitAlert";
      TerminalSettingId2["SplitCwd"] = "terminal.integrated.splitCwd";
      TerminalSettingId2["WindowsEnableConpty"] = "terminal.integrated.windowsEnableConpty";
      TerminalSettingId2["WordSeparators"] = "terminal.integrated.wordSeparators";
      TerminalSettingId2["EnableFileLinks"] = "terminal.integrated.enableFileLinks";
      TerminalSettingId2["AllowedLinkSchemes"] = "terminal.integrated.allowedLinkSchemes";
      TerminalSettingId2["UnicodeVersion"] = "terminal.integrated.unicodeVersion";
      TerminalSettingId2["EnablePersistentSessions"] = "terminal.integrated.enablePersistentSessions";
      TerminalSettingId2["PersistentSessionReviveProcess"] = "terminal.integrated.persistentSessionReviveProcess";
      TerminalSettingId2["HideOnStartup"] = "terminal.integrated.hideOnStartup";
      TerminalSettingId2["CustomGlyphs"] = "terminal.integrated.customGlyphs";
      TerminalSettingId2["RescaleOverlappingGlyphs"] = "terminal.integrated.rescaleOverlappingGlyphs";
      TerminalSettingId2["PersistentSessionScrollback"] = "terminal.integrated.persistentSessionScrollback";
      TerminalSettingId2["InheritEnv"] = "terminal.integrated.inheritEnv";
      TerminalSettingId2["ShowLinkHover"] = "terminal.integrated.showLinkHover";
      TerminalSettingId2["IgnoreProcessNames"] = "terminal.integrated.ignoreProcessNames";
      TerminalSettingId2["ShellIntegrationEnabled"] = "terminal.integrated.shellIntegration.enabled";
      TerminalSettingId2["ShellIntegrationShowWelcome"] = "terminal.integrated.shellIntegration.showWelcome";
      TerminalSettingId2["ShellIntegrationDecorationsEnabled"] = "terminal.integrated.shellIntegration.decorationsEnabled";
      TerminalSettingId2["EnableImages"] = "terminal.integrated.enableImages";
      TerminalSettingId2["SmoothScrolling"] = "terminal.integrated.smoothScrolling";
      TerminalSettingId2["IgnoreBracketedPasteMode"] = "terminal.integrated.ignoreBracketedPasteMode";
      TerminalSettingId2["FocusAfterRun"] = "terminal.integrated.focusAfterRun";
      TerminalSettingId2["FontLigatures"] = "terminal.integrated.fontLigatures";
      TerminalSettingId2["DeveloperPtyHostLatency"] = "terminal.integrated.developer.ptyHost.latency";
      TerminalSettingId2["DeveloperPtyHostStartupDelay"] = "terminal.integrated.developer.ptyHost.startupDelay";
      TerminalSettingId2["DevMode"] = "terminal.integrated.developer.devMode";
    })(TerminalSettingId || (TerminalSettingId = {}));
    (function(PosixShellType2) {
      PosixShellType2["Bash"] = "bash";
      PosixShellType2["Fish"] = "fish";
      PosixShellType2["Sh"] = "sh";
      PosixShellType2["Csh"] = "csh";
      PosixShellType2["Ksh"] = "ksh";
      PosixShellType2["Zsh"] = "zsh";
    })(PosixShellType || (PosixShellType = {}));
    (function(WindowsShellType2) {
      WindowsShellType2["CommandPrompt"] = "cmd";
      WindowsShellType2["Wsl"] = "wsl";
      WindowsShellType2["GitBash"] = "gitbash";
    })(WindowsShellType || (WindowsShellType = {}));
    (function(GeneralShellType2) {
      GeneralShellType2["PowerShell"] = "pwsh";
      GeneralShellType2["Python"] = "python";
      GeneralShellType2["Julia"] = "julia";
      GeneralShellType2["NuShell"] = "nu";
    })(GeneralShellType || (GeneralShellType = {}));
    (function(TitleEventSource2) {
      TitleEventSource2[TitleEventSource2["Api"] = 0] = "Api";
      TitleEventSource2[TitleEventSource2["Process"] = 1] = "Process";
      TitleEventSource2[TitleEventSource2["Sequence"] = 2] = "Sequence";
      TitleEventSource2[TitleEventSource2["Config"] = 3] = "Config";
    })(TitleEventSource || (TitleEventSource = {}));
    (function(TerminalIpcChannels2) {
      TerminalIpcChannels2["LocalPty"] = "localPty";
      TerminalIpcChannels2["PtyHost"] = "ptyHost";
      TerminalIpcChannels2["PtyHostWindow"] = "ptyHostWindow";
      TerminalIpcChannels2["Logger"] = "logger";
      TerminalIpcChannels2["Heartbeat"] = "heartbeat";
    })(TerminalIpcChannels || (TerminalIpcChannels = {}));
    (function(ProcessPropertyType2) {
      ProcessPropertyType2["Cwd"] = "cwd";
      ProcessPropertyType2["InitialCwd"] = "initialCwd";
      ProcessPropertyType2["FixedDimensions"] = "fixedDimensions";
      ProcessPropertyType2["Title"] = "title";
      ProcessPropertyType2["ShellType"] = "shellType";
      ProcessPropertyType2["HasChildProcesses"] = "hasChildProcesses";
      ProcessPropertyType2["ResolvedShellLaunchConfig"] = "resolvedShellLaunchConfig";
      ProcessPropertyType2["OverrideDimensions"] = "overrideDimensions";
      ProcessPropertyType2["FailedShellIntegrationActivation"] = "failedShellIntegrationActivation";
      ProcessPropertyType2["UsedShellIntegrationInjection"] = "usedShellIntegrationInjection";
    })(ProcessPropertyType || (ProcessPropertyType = {}));
    $5x = $Qk("ptyService");
    (function(HeartbeatConstants2) {
      HeartbeatConstants2[HeartbeatConstants2["BeatInterval"] = 5e3] = "BeatInterval";
      HeartbeatConstants2[HeartbeatConstants2["ConnectingBeatInterval"] = 2e4] = "ConnectingBeatInterval";
      HeartbeatConstants2[HeartbeatConstants2["FirstWaitMultiplier"] = 1.2] = "FirstWaitMultiplier";
      HeartbeatConstants2[HeartbeatConstants2["SecondWaitMultiplier"] = 1] = "SecondWaitMultiplier";
      HeartbeatConstants2[HeartbeatConstants2["CreateProcessTimeout"] = 5e3] = "CreateProcessTimeout";
    })(HeartbeatConstants || (HeartbeatConstants = {}));
    (function(TerminalLocation3) {
      TerminalLocation3[TerminalLocation3["Panel"] = 1] = "Panel";
      TerminalLocation3[TerminalLocation3["Editor"] = 2] = "Editor";
    })(TerminalLocation || (TerminalLocation = {}));
    (function(TerminalLocationString2) {
      TerminalLocationString2["TerminalView"] = "view";
      TerminalLocationString2["Editor"] = "editor";
    })(TerminalLocationString || (TerminalLocationString = {}));
    (function(LocalReconnectConstants2) {
      LocalReconnectConstants2[LocalReconnectConstants2["GraceTime"] = 6e4] = "GraceTime";
      LocalReconnectConstants2[LocalReconnectConstants2["ShortGraceTime"] = 6e3] = "ShortGraceTime";
    })(LocalReconnectConstants || (LocalReconnectConstants = {}));
    (function(FlowControlConstants2) {
      FlowControlConstants2[FlowControlConstants2["HighWatermarkChars"] = 1e5] = "HighWatermarkChars";
      FlowControlConstants2[FlowControlConstants2["LowWatermarkChars"] = 5e3] = "LowWatermarkChars";
      FlowControlConstants2[FlowControlConstants2["CharCountAckSize"] = 5e3] = "CharCountAckSize";
    })(FlowControlConstants || (FlowControlConstants = {}));
    (function(ProfileSource2) {
      ProfileSource2["GitBash"] = "Git Bash";
      ProfileSource2["Pwsh"] = "PowerShell";
    })(ProfileSource || (ProfileSource = {}));
    (function(ShellIntegrationStatus2) {
      ShellIntegrationStatus2[ShellIntegrationStatus2["Off"] = 0] = "Off";
      ShellIntegrationStatus2[ShellIntegrationStatus2["FinalTerm"] = 1] = "FinalTerm";
      ShellIntegrationStatus2[ShellIntegrationStatus2["VSCode"] = 2] = "VSCode";
    })(ShellIntegrationStatus || (ShellIntegrationStatus = {}));
    (function(TerminalExitReason3) {
      TerminalExitReason3[TerminalExitReason3["Unknown"] = 0] = "Unknown";
      TerminalExitReason3[TerminalExitReason3["Shutdown"] = 1] = "Shutdown";
      TerminalExitReason3[TerminalExitReason3["Process"] = 2] = "Process";
      TerminalExitReason3[TerminalExitReason3["User"] = 3] = "User";
      TerminalExitReason3[TerminalExitReason3["Extension"] = 4] = "Extension";
    })(TerminalExitReason || (TerminalExitReason = {}));
    $6x = {
      Backend: "workbench.contributions.terminal.processBackend"
    };
    TerminalBackendRegistry = class {
      constructor() {
        this.a = /* @__PURE__ */ new Map();
      }
      get backends() {
        return this.a;
      }
      registerTerminalBackend(backend) {
        const key = this.b(backend.remoteAuthority);
        if (this.a.has(key)) {
          throw new Error(`A terminal backend with remote authority '${key}' was already registered.`);
        }
        this.a.set(key, backend);
      }
      getTerminalBackend(remoteAuthority) {
        return this.a.get(this.b(remoteAuthority));
      }
      b(remoteAuthority) {
        return remoteAuthority?.toLowerCase() ?? "";
      }
    };
    $Wn.add($6x.Backend, new TerminalBackendRegistry());
    $7x = $Qk("localPtyService");
    $8x = $Qk("terminalLogService");
  }
});

// out-build/vs/platform/log/common/logIpc.js
var $qB, $rB;
var init_logIpc = __esm({
  "out-build/vs/platform/log/common/logIpc.js"() {
    "use strict";
    init_uri();
    init_event();
    init_log();
    init_lifecycle();
    $qB = class {
      constructor(a, b) {
        this.a = a;
        this.b = b;
      }
      listen(context, event) {
        const uriTransformer = this.b(context);
        switch (event) {
          case "onDidChangeLoggers":
            return Event.map(this.a.onDidChangeLoggers, (e) => ({
              added: [...e.added].map((logger) => this.c(logger, uriTransformer)),
              removed: [...e.removed].map((logger) => this.c(logger, uriTransformer))
            }));
          case "onDidChangeVisibility":
            return Event.map(this.a.onDidChangeVisibility, (e) => [uriTransformer.transformOutgoingURI(e[0]), e[1]]);
          case "onDidChangeLogLevel":
            return Event.map(this.a.onDidChangeLogLevel, (e) => $yn(e) ? e : [uriTransformer.transformOutgoingURI(e[0]), e[1]]);
        }
        throw new Error(`Event not found: ${event}`);
      }
      async call(context, command, arg) {
        const uriTransformer = this.b(context);
        switch (command) {
          case "setLogLevel":
            return $yn(arg[0]) ? this.a.setLogLevel(arg[0]) : this.a.setLogLevel(URI.revive(uriTransformer.transformIncoming(arg[0][0])), arg[0][1]);
          case "getRegisteredLoggers":
            return Promise.resolve([...this.a.getRegisteredLoggers()].map((logger) => this.c(logger, uriTransformer)));
        }
        throw new Error(`Call not found: ${command}`);
      }
      c(logger, transformer) {
        return {
          ...logger,
          resource: transformer.transformOutgoingURI(logger.resource)
        };
      }
    };
    $rB = class extends $3c {
      constructor(loggerService, channel) {
        super();
        channel.call("setLogLevel", [loggerService.getLogLevel()]);
        this.B(loggerService.onDidChangeLogLevel((arg) => channel.call("setLogLevel", [arg])));
        channel.call("getRegisteredLoggers").then((loggers) => {
          for (const loggerResource of loggers) {
            loggerService.registerLogger({ ...loggerResource, resource: URI.revive(loggerResource.resource) });
          }
        });
        this.B(channel.listen("onDidChangeVisibility")(([resource, visibility]) => loggerService.setVisibility(URI.revive(resource), visibility)));
        this.B(channel.listen("onDidChangeLoggers")(({ added, removed }) => {
          for (const loggerResource of added) {
            loggerService.registerLogger({ ...loggerResource, resource: URI.revive(loggerResource.resource) });
          }
          for (const loggerResource of removed) {
            loggerService.deregisterLogger(loggerResource.resource);
          }
        }));
      }
    };
  }
});

// out-build/vs/platform/terminal/common/requestStore.js
var $sB;
var init_requestStore = __esm({
  "out-build/vs/platform/terminal/common/requestStore.js"() {
    "use strict";
    init_async();
    init_cancellation();
    init_event();
    init_lifecycle();
    init_log();
    $sB = class $sB2 extends $3c {
      /**
       * @param timeout How long in ms to allow requests to go unanswered for, undefined will use the
       * default (15 seconds).
       */
      constructor(timeout, h) {
        super();
        this.h = h;
        this.a = 0;
        this.c = /* @__PURE__ */ new Map();
        this.f = /* @__PURE__ */ new Map();
        this.g = this.B(new $ze());
        this.onCreateRequest = this.g.event;
        this.b = timeout === void 0 ? 15e3 : timeout;
        this.B($1c(() => {
          for (const d of this.f.values()) {
            $Xc(d);
          }
        }));
      }
      /**
       * Creates a request.
       * @param args The arguments to pass to the onCreateRequest event.
       */
      createRequest(args) {
        return new Promise((resolve4, reject) => {
          const requestId = ++this.a;
          this.c.set(requestId, resolve4);
          this.g.fire({ requestId, ...args });
          const tokenSource = new $ad();
          $Wh(this.b, tokenSource.token).then(() => reject(`Request ${requestId} timed out (${this.b}ms)`));
          this.f.set(requestId, [$1c(() => tokenSource.cancel())]);
        });
      }
      /**
       * Accept a reply to a request.
       * @param requestId The request ID originating from the onCreateRequest event.
       * @param data The reply data.
       */
      acceptReply(requestId, data) {
        const resolveRequest = this.c.get(requestId);
        if (resolveRequest) {
          this.c.delete(requestId);
          $Xc(this.f.get(requestId) || []);
          this.f.delete(requestId);
          resolveRequest(data);
        } else {
          this.h.warn(`RequestStore#acceptReply was called without receiving a matching request ${requestId}`);
        }
      }
    };
    $sB = __decorate([
      __param(1, $wn)
    ], $sB);
  }
});

// out-build/vs/platform/terminal/common/terminalProfiles.js
function $tB(detectedProfiles, extensionProfiles) {
  const result = [{
    name: null,
    description: localize(2157, null)
  }];
  result.push(...detectedProfiles.map((e) => {
    return {
      name: e.profileName,
      description: createProfileDescription(e)
    };
  }));
  if (extensionProfiles) {
    result.push(...extensionProfiles.map((extensionProfile) => {
      return {
        name: extensionProfile.title,
        description: createExtensionProfileDescription(extensionProfile)
      };
    }));
  }
  return {
    values: result.map((e) => e.name),
    markdownDescriptions: result.map((e) => e.description)
  };
}
function createProfileDescription(profile) {
  let description = `$(${ThemeIcon.isThemeIcon(profile.icon) ? profile.icon.id : profile.icon ? profile.icon : $6l.terminal.id}) ${profile.profileName}
- path: ${profile.path}`;
  if (profile.args) {
    if (typeof profile.args === "string") {
      description += `
- args: "${profile.args}"`;
    } else {
      description += `
- args: [${profile.args.length === 0 ? "" : `'${profile.args.join(`','`)}'`}]`;
    }
  }
  if (profile.overrideName !== void 0) {
    description += `
- overrideName: ${profile.overrideName}`;
  }
  if (profile.color) {
    description += `
- color: ${profile.color}`;
  }
  if (profile.env) {
    description += `
- env: ${JSON.stringify(profile.env)}`;
  }
  return description;
}
function createExtensionProfileDescription(profile) {
  const description = `$(${ThemeIcon.isThemeIcon(profile.icon) ? profile.icon.id : profile.icon ? profile.icon : $6l.terminal.id}) ${profile.title}
- extensionIdentifier: ${profile.extensionIdentifier}`;
  return description;
}
var init_terminalProfiles = __esm({
  "out-build/vs/platform/terminal/common/terminalProfiles.js"() {
    "use strict";
    init_codicons();
    init_uri();
    init_nls2();
    init_themables();
  }
});

// out-build/vs/platform/terminal/common/terminalPlatformConfiguration.js
function createTerminalProfileMarkdownDescription(platform) {
  const key = platform === 2 ? "linux" : platform === 1 ? "osx" : "windows";
  return localize(2133, null, $k(platform), '```json\n"terminal.integrated.profile.' + key + '": {\n  "bash": null\n}\n```', "[", "](https://code.visualstudio.com/docs/terminal/profiles)");
}
function $zB() {
  $Wn.as($Ht.Configuration).registerConfiguration(terminalPlatformConfiguration);
  $AB();
}
function $AB(detectedProfiles, extensionContributedProfiles) {
  const registry = $Wn.as($Ht.Configuration);
  let profileEnum;
  if (detectedProfiles) {
    profileEnum = $tB(detectedProfiles?.profiles, extensionContributedProfiles);
  }
  const oldDefaultProfilesConfiguration = defaultProfilesConfiguration;
  defaultProfilesConfiguration = {
    id: "terminal",
    order: 100,
    title: localize(2153, null),
    type: "object",
    properties: {
      [
        "terminal.integrated.defaultProfile.linux"
        /* TerminalSettingId.DefaultProfileLinux */
      ]: {
        restricted: true,
        markdownDescription: localize(2154, null),
        type: ["string", "null"],
        default: null,
        enum: detectedProfiles?.os === 3 ? profileEnum?.values : void 0,
        markdownEnumDescriptions: detectedProfiles?.os === 3 ? profileEnum?.markdownDescriptions : void 0
      },
      [
        "terminal.integrated.defaultProfile.osx"
        /* TerminalSettingId.DefaultProfileMacOs */
      ]: {
        restricted: true,
        markdownDescription: localize(2155, null),
        type: ["string", "null"],
        default: null,
        enum: detectedProfiles?.os === 2 ? profileEnum?.values : void 0,
        markdownEnumDescriptions: detectedProfiles?.os === 2 ? profileEnum?.markdownDescriptions : void 0
      },
      [
        "terminal.integrated.defaultProfile.windows"
        /* TerminalSettingId.DefaultProfileWindows */
      ]: {
        restricted: true,
        markdownDescription: localize(2156, null),
        type: ["string", "null"],
        default: null,
        enum: detectedProfiles?.os === 1 ? profileEnum?.values : void 0,
        markdownEnumDescriptions: detectedProfiles?.os === 1 ? profileEnum?.markdownDescriptions : void 0
      }
    }
  };
  registry.updateConfigurations({ add: [defaultProfilesConfiguration], remove: oldDefaultProfilesConfiguration ? [oldDefaultProfilesConfiguration] : [] });
}
var $xB, $yB, terminalProfileBaseProperties, terminalProfileSchema, terminalAutomationProfileSchema, terminalPlatformConfiguration, defaultProfilesConfiguration;
var init_terminalPlatformConfiguration = __esm({
  "out-build/vs/platform/terminal/common/terminalPlatformConfiguration.js"() {
    "use strict";
    init_codicons();
    init_platform();
    init_nls2();
    init_configurationRegistry();
    init_platform2();
    init_terminalProfiles();
    $xB = {
      type: ["string", "null"],
      enum: [
        "terminal.ansiBlack",
        "terminal.ansiRed",
        "terminal.ansiGreen",
        "terminal.ansiYellow",
        "terminal.ansiBlue",
        "terminal.ansiMagenta",
        "terminal.ansiCyan",
        "terminal.ansiWhite"
      ],
      default: null
    };
    $yB = {
      type: "string",
      enum: Array.from($4l(), (icon) => icon.id),
      markdownEnumDescriptions: Array.from($4l(), (icon) => `$(${icon.id})`)
    };
    terminalProfileBaseProperties = {
      args: {
        description: localize(2126, null),
        type: "array",
        items: {
          type: "string"
        }
      },
      overrideName: {
        description: localize(2127, null),
        type: "boolean"
      },
      icon: {
        description: localize(2128, null),
        ...$yB
      },
      color: {
        description: localize(2129, null),
        ...$xB
      },
      env: {
        markdownDescription: localize(2130, null),
        type: "object",
        additionalProperties: {
          type: ["string", "null"]
        },
        default: {}
      }
    };
    terminalProfileSchema = {
      type: "object",
      required: ["path"],
      properties: {
        path: {
          description: localize(2131, null),
          type: ["string", "array"],
          items: {
            type: "string"
          }
        },
        ...terminalProfileBaseProperties
      }
    };
    terminalAutomationProfileSchema = {
      type: "object",
      required: ["path"],
      properties: {
        path: {
          description: localize(2132, null),
          type: ["string"],
          items: {
            type: "string"
          }
        },
        ...terminalProfileBaseProperties
      }
    };
    terminalPlatformConfiguration = {
      id: "terminal",
      order: 100,
      title: localize(2134, null),
      type: "object",
      properties: {
        [
          "terminal.integrated.automationProfile.linux"
          /* TerminalSettingId.AutomationProfileLinux */
        ]: {
          restricted: true,
          markdownDescription: localize(2135, null),
          type: ["object", "null"],
          default: null,
          "anyOf": [
            { type: "null" },
            terminalAutomationProfileSchema
          ],
          defaultSnippets: [
            {
              body: {
                path: "${1}",
                icon: "${2}"
              }
            }
          ]
        },
        [
          "terminal.integrated.automationProfile.osx"
          /* TerminalSettingId.AutomationProfileMacOs */
        ]: {
          restricted: true,
          markdownDescription: localize(2136, null),
          type: ["object", "null"],
          default: null,
          "anyOf": [
            { type: "null" },
            terminalAutomationProfileSchema
          ],
          defaultSnippets: [
            {
              body: {
                path: "${1}",
                icon: "${2}"
              }
            }
          ]
        },
        [
          "terminal.integrated.automationProfile.windows"
          /* TerminalSettingId.AutomationProfileWindows */
        ]: {
          restricted: true,
          markdownDescription: localize(2137, null, "`terminal.integrated.automationShell.windows`"),
          type: ["object", "null"],
          default: null,
          "anyOf": [
            { type: "null" },
            terminalAutomationProfileSchema
          ],
          defaultSnippets: [
            {
              body: {
                path: "${1}",
                icon: "${2}"
              }
            }
          ]
        },
        [
          "terminal.integrated.profiles.windows"
          /* TerminalSettingId.ProfilesWindows */
        ]: {
          restricted: true,
          markdownDescription: createTerminalProfileMarkdownDescription(
            3
            /* Platform.Windows */
          ),
          type: "object",
          default: {
            "PowerShell": {
              source: "PowerShell",
              icon: "terminal-powershell"
            },
            "Command Prompt": {
              path: [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
              ],
              args: [],
              icon: "terminal-cmd"
            },
            "Git Bash": {
              source: "Git Bash"
            }
          },
          additionalProperties: {
            "anyOf": [
              {
                type: "object",
                required: ["source"],
                properties: {
                  source: {
                    description: localize(2138, null),
                    enum: ["PowerShell", "Git Bash"]
                  },
                  ...terminalProfileBaseProperties
                }
              },
              {
                type: "object",
                required: ["extensionIdentifier", "id", "title"],
                properties: {
                  extensionIdentifier: {
                    description: localize(2139, null),
                    type: "string"
                  },
                  id: {
                    description: localize(2140, null),
                    type: "string"
                  },
                  title: {
                    description: localize(2141, null),
                    type: "string"
                  },
                  ...terminalProfileBaseProperties
                }
              },
              { type: "null" },
              terminalProfileSchema
            ]
          }
        },
        [
          "terminal.integrated.profiles.osx"
          /* TerminalSettingId.ProfilesMacOs */
        ]: {
          restricted: true,
          markdownDescription: createTerminalProfileMarkdownDescription(
            1
            /* Platform.Mac */
          ),
          type: "object",
          default: {
            "bash": {
              path: "bash",
              args: ["-l"],
              icon: "terminal-bash"
            },
            "zsh": {
              path: "zsh",
              args: ["-l"]
            },
            "fish": {
              path: "fish",
              args: ["-l"]
            },
            "tmux": {
              path: "tmux",
              icon: "terminal-tmux"
            },
            "pwsh": {
              path: "pwsh",
              icon: "terminal-powershell"
            }
          },
          additionalProperties: {
            "anyOf": [
              {
                type: "object",
                required: ["extensionIdentifier", "id", "title"],
                properties: {
                  extensionIdentifier: {
                    description: localize(2142, null),
                    type: "string"
                  },
                  id: {
                    description: localize(2143, null),
                    type: "string"
                  },
                  title: {
                    description: localize(2144, null),
                    type: "string"
                  },
                  ...terminalProfileBaseProperties
                }
              },
              { type: "null" },
              terminalProfileSchema
            ]
          }
        },
        [
          "terminal.integrated.profiles.linux"
          /* TerminalSettingId.ProfilesLinux */
        ]: {
          restricted: true,
          markdownDescription: createTerminalProfileMarkdownDescription(
            2
            /* Platform.Linux */
          ),
          type: "object",
          default: {
            "bash": {
              path: "bash",
              icon: "terminal-bash"
            },
            "zsh": {
              path: "zsh"
            },
            "fish": {
              path: "fish"
            },
            "tmux": {
              path: "tmux",
              icon: "terminal-tmux"
            },
            "pwsh": {
              path: "pwsh",
              icon: "terminal-powershell"
            }
          },
          additionalProperties: {
            "anyOf": [
              {
                type: "object",
                required: ["extensionIdentifier", "id", "title"],
                properties: {
                  extensionIdentifier: {
                    description: localize(2145, null),
                    type: "string"
                  },
                  id: {
                    description: localize(2146, null),
                    type: "string"
                  },
                  title: {
                    description: localize(2147, null),
                    type: "string"
                  },
                  ...terminalProfileBaseProperties
                }
              },
              { type: "null" },
              terminalProfileSchema
            ]
          }
        },
        [
          "terminal.integrated.useWslProfiles"
          /* TerminalSettingId.UseWslProfiles */
        ]: {
          description: localize(2148, null),
          type: "boolean",
          default: true
        },
        [
          "terminal.integrated.inheritEnv"
          /* TerminalSettingId.InheritEnv */
        ]: {
          scope: 1,
          description: localize(2149, null),
          type: "boolean",
          default: true
        },
        [
          "terminal.integrated.persistentSessionScrollback"
          /* TerminalSettingId.PersistentSessionScrollback */
        ]: {
          scope: 1,
          markdownDescription: localize(2150, null),
          type: "number",
          default: 100
        },
        [
          "terminal.integrated.showLinkHover"
          /* TerminalSettingId.ShowLinkHover */
        ]: {
          scope: 1,
          description: localize(2151, null),
          type: "boolean",
          default: true
        },
        [
          "terminal.integrated.ignoreProcessNames"
          /* TerminalSettingId.IgnoreProcessNames */
        ]: {
          markdownDescription: localize(2152, null, "`#terminal.integrated.confirmOnKill#`"),
          type: "array",
          items: {
            type: "string",
            uniqueItems: true
          },
          default: [
            // Popular prompt programs, these should not count as child processes
            "starship",
            "oh-my-posh",
            // Git bash may runs a subprocess of itself (bin\bash.exe -> usr\bin\bash.exe)
            "bash",
            "zsh"
          ]
        }
      }
    };
  }
});

// out-build/vs/platform/terminal/common/environmentVariable.js
var EnvironmentVariableMutatorType;
var init_environmentVariable = __esm({
  "out-build/vs/platform/terminal/common/environmentVariable.js"() {
    "use strict";
    (function(EnvironmentVariableMutatorType3) {
      EnvironmentVariableMutatorType3[EnvironmentVariableMutatorType3["Replace"] = 1] = "Replace";
      EnvironmentVariableMutatorType3[EnvironmentVariableMutatorType3["Append"] = 2] = "Append";
      EnvironmentVariableMutatorType3[EnvironmentVariableMutatorType3["Prepend"] = 3] = "Prepend";
    })(EnvironmentVariableMutatorType || (EnvironmentVariableMutatorType = {}));
  }
});

// out-build/vs/platform/terminal/common/environmentVariableShared.js
function $BB(collection) {
  return [...collection.entries()];
}
function $CB(descriptionMap) {
  return descriptionMap ? [...descriptionMap.entries()] : [];
}
function $DB(serializedCollection) {
  return new Map(serializedCollection);
}
function $EB(serializableEnvironmentDescription) {
  return new Map(serializableEnvironmentDescription ?? []);
}
var init_environmentVariableShared = __esm({
  "out-build/vs/platform/terminal/common/environmentVariableShared.js"() {
    "use strict";
  }
});

// out-build/vs/platform/terminal/common/environmentVariableCollection.js
function filterScope(mutator, scope, strictFilter = false) {
  if (!mutator.scope) {
    if (strictFilter) {
      return scope === mutator.scope;
    }
    return true;
  }
  if (mutator.scope.workspaceFolder && scope?.workspaceFolder && mutator.scope.workspaceFolder.index === scope.workspaceFolder.index) {
    return true;
  }
  return false;
}
function getMissingMutatorsFromArray(current, other) {
  if (!other) {
    return current;
  }
  const otherMutatorExtensions = /* @__PURE__ */ new Set();
  other.forEach((m) => otherMutatorExtensions.add(m.extensionIdentifier));
  const result = [];
  current.forEach((mutator) => {
    if (!otherMutatorExtensions.has(mutator.extensionIdentifier)) {
      result.push(mutator);
    }
  });
  return result.length === 0 ? void 0 : result;
}
function getChangedMutatorsFromArray(current, other) {
  if (!other) {
    return void 0;
  }
  const otherMutatorExtensions = /* @__PURE__ */ new Map();
  other.forEach((m) => otherMutatorExtensions.set(m.extensionIdentifier, m));
  const result = [];
  current.forEach((mutator) => {
    const otherMutator = otherMutatorExtensions.get(mutator.extensionIdentifier);
    if (otherMutator && (mutator.type !== otherMutator.type || mutator.value !== otherMutator.value || mutator.scope?.workspaceFolder?.index !== otherMutator.scope?.workspaceFolder?.index)) {
      result.push(otherMutator);
    }
  });
  return result.length === 0 ? void 0 : result;
}
var mutatorTypeToLabelMap, $HB;
var init_environmentVariableCollection = __esm({
  "out-build/vs/platform/terminal/common/environmentVariableCollection.js"() {
    "use strict";
    init_platform();
    init_environmentVariable();
    mutatorTypeToLabelMap = /* @__PURE__ */ new Map([
      [EnvironmentVariableMutatorType.Append, "APPEND"],
      [EnvironmentVariableMutatorType.Prepend, "PREPEND"],
      [EnvironmentVariableMutatorType.Replace, "REPLACE"]
    ]);
    $HB = class {
      constructor(collections) {
        this.collections = collections;
        this.a = /* @__PURE__ */ new Map();
        this.b = /* @__PURE__ */ new Map();
        collections.forEach((collection, extensionIdentifier) => {
          this.d(collection, extensionIdentifier);
          const it = collection.map.entries();
          let next = it.next();
          while (!next.done) {
            const mutator = next.value[1];
            const key = next.value[0];
            let entry = this.a.get(key);
            if (!entry) {
              entry = [];
              this.a.set(key, entry);
            }
            if (entry.length > 0 && entry[0].type === EnvironmentVariableMutatorType.Replace) {
              next = it.next();
              continue;
            }
            const extensionMutator = {
              extensionIdentifier,
              value: mutator.value,
              type: mutator.type,
              scope: mutator.scope,
              variable: mutator.variable,
              options: mutator.options
            };
            if (!extensionMutator.scope) {
              delete extensionMutator.scope;
            }
            entry.unshift(extensionMutator);
            next = it.next();
          }
        });
      }
      async applyToProcessEnvironment(env2, scope, variableResolver) {
        let lowerToActualVariableNames;
        if ($l) {
          lowerToActualVariableNames = {};
          Object.keys(env2).forEach((e) => lowerToActualVariableNames[e.toLowerCase()] = e);
        }
        for (const [variable, mutators] of this.getVariableMap(scope)) {
          const actualVariable = $l ? lowerToActualVariableNames[variable.toLowerCase()] || variable : variable;
          for (const mutator of mutators) {
            const value = variableResolver ? await variableResolver(mutator.value) : mutator.value;
            if (mutator.options?.applyAtProcessCreation ?? true) {
              switch (mutator.type) {
                case EnvironmentVariableMutatorType.Append:
                  env2[actualVariable] = (env2[actualVariable] || "") + value;
                  break;
                case EnvironmentVariableMutatorType.Prepend:
                  env2[actualVariable] = value + (env2[actualVariable] || "");
                  break;
                case EnvironmentVariableMutatorType.Replace:
                  env2[actualVariable] = value;
                  break;
              }
            }
            if (mutator.options?.applyAtShellIntegration ?? false) {
              const key = `VSCODE_ENV_${mutatorTypeToLabelMap.get(mutator.type)}`;
              env2[key] = (env2[key] ? env2[key] + ":" : "") + variable + "=" + this.c(value);
            }
          }
        }
      }
      c(value) {
        return value.replaceAll(":", "\\x3a");
      }
      diff(other, scope) {
        const added = /* @__PURE__ */ new Map();
        const changed = /* @__PURE__ */ new Map();
        const removed = /* @__PURE__ */ new Map();
        other.getVariableMap(scope).forEach((otherMutators, variable) => {
          const currentMutators = this.getVariableMap(scope).get(variable);
          const result = getMissingMutatorsFromArray(otherMutators, currentMutators);
          if (result) {
            added.set(variable, result);
          }
        });
        this.getVariableMap(scope).forEach((currentMutators, variable) => {
          const otherMutators = other.getVariableMap(scope).get(variable);
          const result = getMissingMutatorsFromArray(currentMutators, otherMutators);
          if (result) {
            removed.set(variable, result);
          }
        });
        this.getVariableMap(scope).forEach((currentMutators, variable) => {
          const otherMutators = other.getVariableMap(scope).get(variable);
          const result = getChangedMutatorsFromArray(currentMutators, otherMutators);
          if (result) {
            changed.set(variable, result);
          }
        });
        if (added.size === 0 && changed.size === 0 && removed.size === 0) {
          return void 0;
        }
        return { added, changed, removed };
      }
      getVariableMap(scope) {
        const result = /* @__PURE__ */ new Map();
        for (const mutators of this.a.values()) {
          const filteredMutators = mutators.filter((m) => filterScope(m, scope));
          if (filteredMutators.length > 0) {
            result.set(filteredMutators[0].variable, filteredMutators);
          }
        }
        return result;
      }
      getDescriptionMap(scope) {
        const result = /* @__PURE__ */ new Map();
        for (const mutators of this.b.values()) {
          const filteredMutators = mutators.filter((m) => filterScope(m, scope, true));
          for (const mutator of filteredMutators) {
            result.set(mutator.extensionIdentifier, mutator.description);
          }
        }
        return result;
      }
      d(collection, extensionIdentifier) {
        if (!collection.descriptionMap) {
          return;
        }
        const it = collection.descriptionMap.entries();
        let next = it.next();
        while (!next.done) {
          const mutator = next.value[1];
          const key = next.value[0];
          let entry = this.b.get(key);
          if (!entry) {
            entry = [];
            this.b.set(key, entry);
          }
          const extensionMutator = {
            extensionIdentifier,
            scope: mutator.scope,
            description: mutator.description
          };
          if (!extensionMutator.scope) {
            delete extensionMutator.scope;
          }
          entry.push(extensionMutator);
          next = it.next();
        }
      }
    };
  }
});

// out-build/vs/platform/terminal/node/terminalEnvironment.js
import * as os3 from "os";
function $IB() {
  const osVersion = /(\d+)\.(\d+)\.(\d+)/g.exec(os3.release());
  let buildNumber = 0;
  if (osVersion && osVersion.length === 4) {
    buildNumber = parseInt(osVersion[3]);
  }
  return buildNumber;
}
async function $JB(command, cwd3, paths, env2 = env, exists2 = Promises2.exists) {
  if ($mc(command)) {
    return await exists2(command) ? command : void 0;
  }
  if (cwd3 === void 0) {
    cwd3 = cwd();
  }
  const dir = $qc(command);
  if (dir !== ".") {
    const fullPath2 = $nc(cwd3, command);
    return await exists2(fullPath2) ? fullPath2 : void 0;
  }
  const envPath = $Sv(env2, "PATH");
  if (paths === void 0 && $zg(envPath)) {
    paths = envPath.split($xc);
  }
  if (paths === void 0 || paths.length === 0) {
    const fullPath2 = $nc(cwd3, command);
    return await exists2(fullPath2) ? fullPath2 : void 0;
  }
  for (const pathEntry of paths) {
    let fullPath2;
    if ($mc(pathEntry)) {
      fullPath2 = $nc(pathEntry, command);
    } else {
      fullPath2 = $nc(cwd3, pathEntry, command);
    }
    if (await exists2(fullPath2)) {
      return fullPath2;
    }
    if ($l) {
      let withExtension = fullPath2 + ".com";
      if (await exists2(withExtension)) {
        return withExtension;
      }
      withExtension = fullPath2 + ".exe";
      if (await exists2(withExtension)) {
        return withExtension;
      }
    }
  }
  const fullPath = $nc(cwd3, command);
  return await exists2(fullPath) ? fullPath : void 0;
}
var ShellIntegrationExecutable, shellIntegrationArgs;
var init_terminalEnvironment = __esm({
  "out-build/vs/platform/terminal/node/terminalEnvironment.js"() {
    "use strict";
    init_network();
    init_objects();
    init_path();
    init_platform();
    init_process();
    init_strings();
    init_types();
    init_pfs();
    init_environmentVariable();
    init_environmentVariableShared();
    init_environmentVariableCollection();
    (function(ShellIntegrationExecutable2) {
      ShellIntegrationExecutable2["WindowsPwsh"] = "windows-pwsh";
      ShellIntegrationExecutable2["WindowsPwshLogin"] = "windows-pwsh-login";
      ShellIntegrationExecutable2["Pwsh"] = "pwsh";
      ShellIntegrationExecutable2["PwshLogin"] = "pwsh-login";
      ShellIntegrationExecutable2["Zsh"] = "zsh";
      ShellIntegrationExecutable2["ZshLogin"] = "zsh-login";
      ShellIntegrationExecutable2["Bash"] = "bash";
      ShellIntegrationExecutable2["Fish"] = "fish";
      ShellIntegrationExecutable2["FishLogin"] = "fish-login";
    })(ShellIntegrationExecutable || (ShellIntegrationExecutable = {}));
    shellIntegrationArgs = /* @__PURE__ */ new Map();
    shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwsh, ["-noexit", "-command", 'try { . "{0}\\out\\vs\\workbench\\contrib\\terminal\\common\\scripts\\shellIntegration.ps1" } catch {}{1}']);
    shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwshLogin, ["-l", "-noexit", "-command", 'try { . "{0}\\out\\vs\\workbench\\contrib\\terminal\\common\\scripts\\shellIntegration.ps1" } catch {}{1}']);
    shellIntegrationArgs.set(ShellIntegrationExecutable.Pwsh, ["-noexit", "-command", '. "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1"{1}']);
    shellIntegrationArgs.set(ShellIntegrationExecutable.PwshLogin, ["-l", "-noexit", "-command", '. "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1"']);
    shellIntegrationArgs.set(ShellIntegrationExecutable.Zsh, ["-i"]);
    shellIntegrationArgs.set(ShellIntegrationExecutable.ZshLogin, ["-il"]);
    shellIntegrationArgs.set(ShellIntegrationExecutable.Bash, ["--init-file", "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh"]);
    shellIntegrationArgs.set(ShellIntegrationExecutable.Fish, ["--init-command", 'source "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish"']);
    shellIntegrationArgs.set(ShellIntegrationExecutable.FishLogin, ["-l", "--init-command", 'source "{0}/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish"']);
  }
});

// out-build/vs/platform/terminal/node/terminalProfiles.js
import * as fs9 from "fs";
import * as cp2 from "child_process";
import { dirname as dirname3, resolve as resolve2 } from "path";
function $LB(profiles, defaultProfile, includeDetectedProfiles, configurationService, shellEnv = process.env, fsProvider, logService, variableResolver, testPwshSourcePaths) {
  fsProvider = fsProvider || {
    existsFile: SymlinkSupport.existsFile,
    readFile: fs9.promises.readFile
  };
  if ($l) {
    return detectAvailableWindowsProfiles(includeDetectedProfiles, fsProvider, shellEnv, logService, configurationService.getValue(
      "terminal.integrated.useWslProfiles"
      /* TerminalSettingId.UseWslProfiles */
    ) !== false, profiles && typeof profiles === "object" ? { ...profiles } : configurationService.getValue(
      "terminal.integrated.profiles.windows"
      /* TerminalSettingId.ProfilesWindows */
    ), typeof defaultProfile === "string" ? defaultProfile : configurationService.getValue(
      "terminal.integrated.defaultProfile.windows"
      /* TerminalSettingId.DefaultProfileWindows */
    ), testPwshSourcePaths, variableResolver);
  }
  return detectAvailableUnixProfiles(fsProvider, logService, includeDetectedProfiles, profiles && typeof profiles === "object" ? { ...profiles } : configurationService.getValue(
    $n ? "terminal.integrated.profiles.linux" : "terminal.integrated.profiles.osx"
    /* TerminalSettingId.ProfilesMacOs */
  ), typeof defaultProfile === "string" ? defaultProfile : configurationService.getValue(
    $n ? "terminal.integrated.defaultProfile.linux" : "terminal.integrated.defaultProfile.osx"
    /* TerminalSettingId.DefaultProfileMacOs */
  ), testPwshSourcePaths, variableResolver, shellEnv);
}
async function detectAvailableWindowsProfiles(includeDetectedProfiles, fsProvider, shellEnv, logService, useWslProfiles, configProfiles, defaultProfileName, testPwshSourcePaths, variableResolver) {
  const is32ProcessOn64Windows = process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432");
  const system32Path = `${process.env["windir"]}\\${is32ProcessOn64Windows ? "Sysnative" : "System32"}`;
  let useWSLexe = false;
  if ($IB() >= 16299) {
    useWSLexe = true;
  }
  await initializeWindowsProfiles(testPwshSourcePaths);
  const detectedProfiles = /* @__PURE__ */ new Map();
  if (includeDetectedProfiles) {
    detectedProfiles.set("PowerShell", {
      source: "PowerShell",
      icon: $6l.terminalPowershell,
      isAutoDetected: true
    });
    detectedProfiles.set("Windows PowerShell", {
      path: `${system32Path}\\WindowsPowerShell\\v1.0\\powershell.exe`,
      icon: $6l.terminalPowershell,
      isAutoDetected: true
    });
    detectedProfiles.set("Git Bash", {
      source: "Git Bash",
      isAutoDetected: true
    });
    detectedProfiles.set("Command Prompt", {
      path: `${system32Path}\\cmd.exe`,
      icon: $6l.terminalCmd,
      isAutoDetected: true
    });
    detectedProfiles.set("Cygwin", {
      path: [
        { path: `${process.env["HOMEDRIVE"]}\\cygwin64\\bin\\bash.exe`, isUnsafe: true },
        { path: `${process.env["HOMEDRIVE"]}\\cygwin\\bin\\bash.exe`, isUnsafe: true }
      ],
      args: ["--login"],
      isAutoDetected: true
    });
    detectedProfiles.set("bash (MSYS2)", {
      path: [
        { path: `${process.env["HOMEDRIVE"]}\\msys64\\usr\\bin\\bash.exe`, isUnsafe: true }
      ],
      args: ["--login", "-i"],
      // CHERE_INVOKING retains current working directory
      env: { CHERE_INVOKING: "1" },
      icon: $6l.terminalBash,
      isAutoDetected: true
    });
    const cmderPath = `${process.env["CMDER_ROOT"] || `${process.env["HOMEDRIVE"]}\\cmder`}\\vendor\\bin\\vscode_init.cmd`;
    detectedProfiles.set("Cmder", {
      path: `${system32Path}\\cmd.exe`,
      args: ["/K", cmderPath],
      // The path is safe if it was derived from CMDER_ROOT
      requiresPath: process.env["CMDER_ROOT"] ? cmderPath : { path: cmderPath, isUnsafe: true },
      isAutoDetected: true
    });
  }
  applyConfigProfilesToMap(configProfiles, detectedProfiles);
  const resultProfiles = await transformToTerminalProfiles(detectedProfiles.entries(), defaultProfileName, fsProvider, shellEnv, logService, variableResolver);
  if (includeDetectedProfiles && useWslProfiles) {
    try {
      const result = await getWslProfiles(`${system32Path}\\${useWSLexe ? "wsl" : "bash"}.exe`, defaultProfileName);
      for (const wslProfile of result) {
        if (!configProfiles || !(wslProfile.profileName in configProfiles)) {
          resultProfiles.push(wslProfile);
        }
      }
    } catch (e) {
      if (logIfWslNotInstalled) {
        logService?.trace("WSL is not installed, so could not detect WSL profiles");
        logIfWslNotInstalled = false;
      }
    }
  }
  return resultProfiles;
}
async function transformToTerminalProfiles(entries, defaultProfileName, fsProvider, shellEnv = process.env, logService, variableResolver) {
  const promises15 = [];
  for (const [profileName, profile] of entries) {
    promises15.push(getValidatedProfile(profileName, profile, defaultProfileName, fsProvider, shellEnv, logService, variableResolver));
  }
  return (await Promise.all(promises15)).filter((e) => !!e);
}
async function getValidatedProfile(profileName, profile, defaultProfileName, fsProvider, shellEnv = process.env, logService, variableResolver) {
  if (profile === null) {
    return void 0;
  }
  let originalPaths;
  let args;
  let icon = void 0;
  if ("source" in profile && !("path" in profile)) {
    const source = profileSources?.get(profile.source);
    if (!source) {
      return void 0;
    }
    originalPaths = source.paths;
    args = profile.args || source.args;
    if (profile.icon) {
      icon = validateIcon(profile.icon);
    } else if (source.icon) {
      icon = source.icon;
    }
  } else {
    originalPaths = Array.isArray(profile.path) ? profile.path : [profile.path];
    args = $l ? profile.args : Array.isArray(profile.args) ? profile.args : void 0;
    icon = validateIcon(profile.icon);
  }
  let paths;
  if (variableResolver) {
    const mapped = originalPaths.map((e) => typeof e === "string" ? e : e.path);
    const resolved = await variableResolver(mapped);
    paths = new Array(originalPaths.length);
    for (let i = 0; i < originalPaths.length; i++) {
      if (typeof originalPaths[i] === "string") {
        paths[i] = resolved[i];
      } else {
        paths[i] = {
          path: resolved[i],
          isUnsafe: true
        };
      }
    }
  } else {
    paths = originalPaths.slice();
  }
  let requiresUnsafePath;
  if (profile.requiresPath) {
    let actualRequiredPath;
    if ($zg(profile.requiresPath)) {
      actualRequiredPath = profile.requiresPath;
    } else {
      actualRequiredPath = profile.requiresPath.path;
      if (profile.requiresPath.isUnsafe) {
        requiresUnsafePath = actualRequiredPath;
      }
    }
    const result = await fsProvider.existsFile(actualRequiredPath);
    if (!result) {
      return;
    }
  }
  const validatedProfile = await validateProfilePaths(profileName, defaultProfileName, paths, fsProvider, shellEnv, args, profile.env, profile.overrideName, profile.isAutoDetected, requiresUnsafePath);
  if (!validatedProfile) {
    logService?.debug("Terminal profile not validated", profileName, originalPaths);
    return void 0;
  }
  validatedProfile.isAutoDetected = profile.isAutoDetected;
  validatedProfile.icon = icon;
  validatedProfile.color = profile.color;
  return validatedProfile;
}
function validateIcon(icon) {
  if (typeof icon === "string") {
    return { id: icon };
  }
  return icon;
}
async function initializeWindowsProfiles(testPwshSourcePaths) {
  if (profileSources && !testPwshSourcePaths) {
    return;
  }
  const [gitBashPaths, pwshPaths] = await Promise.all([getGitBashPaths(), testPwshSourcePaths || getPowershellPaths()]);
  profileSources = /* @__PURE__ */ new Map();
  profileSources.set("Git Bash", {
    profileName: "Git Bash",
    paths: gitBashPaths,
    args: ["--login", "-i"]
  });
  profileSources.set("PowerShell", {
    profileName: "PowerShell",
    paths: pwshPaths,
    icon: $6l.terminalPowershell
  });
}
async function getGitBashPaths() {
  const gitDirs = /* @__PURE__ */ new Set();
  const gitExePath = await $JB("git.exe");
  if (gitExePath) {
    const gitExeDir = dirname3(gitExePath);
    gitDirs.add(resolve2(gitExeDir, "../.."));
  }
  function addTruthy(set, value) {
    if (value) {
      set.add(value);
    }
  }
  addTruthy(gitDirs, process.env["ProgramW6432"]);
  addTruthy(gitDirs, process.env["ProgramFiles"]);
  addTruthy(gitDirs, process.env["ProgramFiles(X86)"]);
  addTruthy(gitDirs, `${process.env["LocalAppData"]}\\Program`);
  const gitBashPaths = [];
  for (const gitDir of gitDirs) {
    gitBashPaths.push(
      `${gitDir}\\Git\\bin\\bash.exe`,
      `${gitDir}\\Git\\usr\\bin\\bash.exe`,
      `${gitDir}\\usr\\bin\\bash.exe`
      // using Git for Windows SDK
    );
  }
  gitBashPaths.push(`${process.env["UserProfile"]}\\scoop\\apps\\git\\current\\bin\\bash.exe`);
  gitBashPaths.push(`${process.env["UserProfile"]}\\scoop\\apps\\git-with-openssh\\current\\bin\\bash.exe`);
  return gitBashPaths;
}
async function getPowershellPaths() {
  const paths = [];
  for await (const pwshExe of $Qx()) {
    paths.push(pwshExe.exePath);
  }
  return paths;
}
async function getWslProfiles(wslPath, defaultProfileName) {
  const profiles = [];
  const distroOutput = await new Promise((resolve4, reject) => {
    cp2.exec("wsl.exe -l -q", { encoding: "utf16le", timeout: 1e3 }, (err, stdout) => {
      if (err) {
        return reject("Problem occurred when getting wsl distros");
      }
      resolve4(stdout);
    });
  });
  if (!distroOutput) {
    return [];
  }
  const regex = new RegExp(/[\r?\n]/);
  const distroNames = distroOutput.split(regex).filter((t) => t.trim().length > 0 && t !== "");
  for (const distroName of distroNames) {
    if (distroName === "") {
      continue;
    }
    if (distroName.startsWith("docker-desktop")) {
      continue;
    }
    const profileName = `${distroName} (WSL)`;
    const profile = {
      profileName,
      path: wslPath,
      args: [`-d`, `${distroName}`],
      isDefault: profileName === defaultProfileName,
      icon: getWslIcon(distroName),
      isAutoDetected: false
    };
    profiles.push(profile);
  }
  return profiles;
}
function getWslIcon(distroName) {
  if (distroName.includes("Ubuntu")) {
    return $6l.terminalUbuntu;
  } else if (distroName.includes("Debian")) {
    return $6l.terminalDebian;
  } else {
    return $6l.terminalLinux;
  }
}
async function detectAvailableUnixProfiles(fsProvider, logService, includeDetectedProfiles, configProfiles, defaultProfileName, testPaths, variableResolver, shellEnv) {
  const detectedProfiles = /* @__PURE__ */ new Map();
  if (includeDetectedProfiles && await fsProvider.existsFile(
    "/etc/shells"
    /* Constants.UnixShellsPath */
  )) {
    const contents = (await fsProvider.readFile(
      "/etc/shells"
      /* Constants.UnixShellsPath */
    )).toString();
    const profiles = (testPaths || contents.split("\n")).map((e) => {
      const index = e.indexOf("#");
      return index === -1 ? e : e.substring(0, index);
    }).filter((e) => e.trim().length > 0);
    const counts = /* @__PURE__ */ new Map();
    for (const profile of profiles) {
      let profileName = $rc(profile);
      let count = counts.get(profileName) || 0;
      count++;
      if (count > 1) {
        profileName = `${profileName} (${count})`;
      }
      counts.set(profileName, count);
      detectedProfiles.set(profileName, { path: profile, isAutoDetected: true });
    }
  }
  applyConfigProfilesToMap(configProfiles, detectedProfiles);
  return await transformToTerminalProfiles(detectedProfiles.entries(), defaultProfileName, fsProvider, shellEnv, logService, variableResolver);
}
function applyConfigProfilesToMap(configProfiles, profilesMap) {
  if (!configProfiles) {
    return;
  }
  for (const [profileName, value] of Object.entries(configProfiles)) {
    if (value === null || typeof value !== "object" || !("path" in value) && !("source" in value)) {
      profilesMap.delete(profileName);
    } else {
      value.icon = value.icon || profilesMap.get(profileName)?.icon;
      profilesMap.set(profileName, value);
    }
  }
}
async function validateProfilePaths(profileName, defaultProfileName, potentialPaths, fsProvider, shellEnv, args, env2, overrideName, isAutoDetected, requiresUnsafePath) {
  if (potentialPaths.length === 0) {
    return Promise.resolve(void 0);
  }
  const path7 = potentialPaths.shift();
  if (path7 === "") {
    return validateProfilePaths(profileName, defaultProfileName, potentialPaths, fsProvider, shellEnv, args, env2, overrideName, isAutoDetected);
  }
  const isUnsafePath = typeof path7 !== "string" && path7.isUnsafe;
  const actualPath = typeof path7 === "string" ? path7 : path7.path;
  const profile = {
    profileName,
    path: actualPath,
    args,
    env: env2,
    overrideName,
    isAutoDetected,
    isDefault: profileName === defaultProfileName,
    isUnsafePath,
    requiresUnsafePath
  };
  if ($rc(actualPath) === actualPath) {
    const envPaths = shellEnv.PATH ? shellEnv.PATH.split($xc) : void 0;
    const executable = await $JB(actualPath, void 0, envPaths, void 0, fsProvider.existsFile);
    if (!executable) {
      return validateProfilePaths(profileName, defaultProfileName, potentialPaths, fsProvider, shellEnv, args);
    }
    profile.path = executable;
    profile.isFromPath = true;
    return profile;
  }
  const result = await fsProvider.existsFile($lc(actualPath));
  if (result) {
    return profile;
  }
  return validateProfilePaths(profileName, defaultProfileName, potentialPaths, fsProvider, shellEnv, args, env2, overrideName, isAutoDetected);
}
var Constants2, profileSources, logIfWslNotInstalled;
var init_terminalProfiles2 = __esm({
  "out-build/vs/platform/terminal/node/terminalProfiles.js"() {
    "use strict";
    init_codicons();
    init_path();
    init_platform();
    init_types();
    init_pfs();
    init_powershell();
    init_terminalEnvironment();
    (function(Constants4) {
      Constants4["UnixShellsPath"] = "/etc/shells";
    })(Constants2 || (Constants2 = {}));
    logIfWslNotInstalled = true;
  }
});

// out-build/vs/platform/terminal/node/ptyHostService.js
var Constants3, $MB;
var init_ptyHostService = __esm({
  "out-build/vs/platform/terminal/node/ptyHostService.js"() {
    "use strict";
    init_event();
    init_lifecycle();
    init_platform();
    init_ipc();
    init_configuration();
    init_log();
    init_logIpc();
    init_shellEnv();
    init_requestStore();
    init_terminal();
    init_terminalPlatformConfiguration();
    init_terminalProfiles2();
    init_shell();
    init_stopwatch();
    (function(Constants4) {
      Constants4[Constants4["MaxRestarts"] = 5] = "MaxRestarts";
    })(Constants3 || (Constants3 = {}));
    $MB = class $MB2 extends $3c {
      get c() {
        this.h();
        return this.a;
      }
      get f() {
        this.h();
        return this.b;
      }
      /**
       * Get the proxy if it exists, otherwise undefined. This is used when calls are not needed to be
       * passed through to the pty host if it has not yet been spawned.
       */
      get g() {
        return this.b;
      }
      h() {
        if (!this.a) {
          this.U();
        }
      }
      constructor(M, N, O, P) {
        super();
        this.M = M;
        this.N = N;
        this.O = O;
        this.P = P;
        this.m = false;
        this.n = 0;
        this.r = true;
        this.u = this.B(new $ze());
        this.onPtyHostExit = this.u.event;
        this.w = this.B(new $ze());
        this.onPtyHostStart = this.w.event;
        this.y = this.B(new $ze());
        this.onPtyHostUnresponsive = this.y.event;
        this.z = this.B(new $ze());
        this.onPtyHostResponsive = this.z.event;
        this.C = this.B(new $ze());
        this.onPtyHostRequestResolveVariables = this.C.event;
        this.D = this.B(new $ze());
        this.onProcessData = this.D.event;
        this.F = this.B(new $ze());
        this.onProcessReady = this.F.event;
        this.G = this.B(new $ze());
        this.onProcessReplay = this.G.event;
        this.H = this.B(new $ze());
        this.onProcessOrphanQuestion = this.H.event;
        this.I = this.B(new $ze());
        this.onDidRequestDetach = this.I.event;
        this.J = this.B(new $ze());
        this.onDidChangeProperty = this.J.event;
        this.L = this.B(new $ze());
        this.onProcessExit = this.L.event;
        $zB();
        this.B(this.M);
        this.B($1c(() => this.W()));
        this.j = this.B(new $sB(void 0, this.O));
        this.B(this.j.onCreateRequest(this.C.fire, this.C));
        if (this.M.onRequestConnection) {
          this.B(Event.once(this.M.onRequestConnection)(() => this.h()));
        }
        if (this.M.onWillShutdown) {
          this.B(this.M.onWillShutdown(() => this.m = true));
        }
      }
      get Q() {
        return this.N.getValue(
          "terminal.integrated.ignoreProcessNames"
          /* TerminalSettingId.IgnoreProcessNames */
        );
      }
      async R() {
        return this.g?.refreshIgnoreProcessNames?.(this.Q);
      }
      async S() {
        if ($l) {
          return process.env;
        }
        try {
          return await $Vx(this.N, this.O, { _: [] }, process.env);
        } catch (error) {
          this.O.error("ptyHost was unable to resolve shell environment", error);
          return {};
        }
      }
      U() {
        const connection = this.M.start();
        const client = connection.client;
        if (this.O.getLevel() === LogLevel.Trace) {
          this.O.trace("PtyHostService#_startPtyHost", new Error().stack?.replace(/^Error/, ""));
        }
        const heartbeatService = ProxyChannel.toService(client.getChannel(TerminalIpcChannels.Heartbeat));
        heartbeatService.onBeat(() => this.X());
        this.X(true);
        this.B(connection.onDidProcessExit((e) => {
          this.u.fire(e.code);
          if (!this.m && !this.q.isDisposed) {
            if (this.n <= Constants3.MaxRestarts) {
              this.O.error(`ptyHost terminated unexpectedly with code ${e.code}`);
              this.n++;
              this.restartPtyHost();
            } else {
              this.O.error(`ptyHost terminated unexpectedly with code ${e.code}, giving up`);
            }
          }
        }));
        const proxy = ProxyChannel.toService(client.getChannel(TerminalIpcChannels.PtyHost));
        this.B(proxy.onProcessData((e) => this.D.fire(e)));
        this.B(proxy.onProcessReady((e) => this.F.fire(e)));
        this.B(proxy.onProcessExit((e) => this.L.fire(e)));
        this.B(proxy.onDidChangeProperty((e) => this.J.fire(e)));
        this.B(proxy.onProcessReplay((e) => this.G.fire(e)));
        this.B(proxy.onProcessOrphanQuestion((e) => this.H.fire(e)));
        this.B(proxy.onDidRequestDetach((e) => this.I.fire(e)));
        this.B(new $rB(this.P, client.getChannel(TerminalIpcChannels.Logger)));
        this.a = connection;
        this.b = proxy;
        this.w.fire();
        this.B(this.N.onDidChangeConfiguration(async (e) => {
          if (e.affectsConfiguration(
            "terminal.integrated.ignoreProcessNames"
            /* TerminalSettingId.IgnoreProcessNames */
          )) {
            await this.R();
          }
        }));
        this.R();
        return [connection, proxy];
      }
      async createProcess(shellLaunchConfig, cwd3, cols, rows, unicodeVersion, env2, executableEnv, options2, shouldPersist, workspaceId, workspaceName) {
        const timeout = setTimeout(() => this.$(), HeartbeatConstants.CreateProcessTimeout);
        const id2 = await this.f.createProcess(shellLaunchConfig, cwd3, cols, rows, unicodeVersion, env2, executableEnv, options2, shouldPersist, workspaceId, workspaceName);
        clearTimeout(timeout);
        return id2;
      }
      updateTitle(id2, title, titleSource) {
        return this.f.updateTitle(id2, title, titleSource);
      }
      updateIcon(id2, userInitiated, icon, color2) {
        return this.f.updateIcon(id2, userInitiated, icon, color2);
      }
      attachToProcess(id2) {
        return this.f.attachToProcess(id2);
      }
      detachFromProcess(id2, forcePersist) {
        return this.f.detachFromProcess(id2, forcePersist);
      }
      shutdownAll() {
        return this.f.shutdownAll();
      }
      listProcesses() {
        return this.f.listProcesses();
      }
      async getPerformanceMarks() {
        return this.g?.getPerformanceMarks() ?? [];
      }
      async reduceConnectionGraceTime() {
        return this.g?.reduceConnectionGraceTime();
      }
      start(id2) {
        return this.f.start(id2);
      }
      shutdown(id2, immediate) {
        return this.f.shutdown(id2, immediate);
      }
      input(id2, data) {
        return this.f.input(id2, data);
      }
      processBinary(id2, data) {
        return this.f.processBinary(id2, data);
      }
      resize(id2, cols, rows) {
        return this.f.resize(id2, cols, rows);
      }
      clearBuffer(id2) {
        return this.f.clearBuffer(id2);
      }
      acknowledgeDataEvent(id2, charCount) {
        return this.f.acknowledgeDataEvent(id2, charCount);
      }
      setUnicodeVersion(id2, version) {
        return this.f.setUnicodeVersion(id2, version);
      }
      getInitialCwd(id2) {
        return this.f.getInitialCwd(id2);
      }
      getCwd(id2) {
        return this.f.getCwd(id2);
      }
      async getLatency() {
        const sw = new $te();
        const results = await this.f.getLatency();
        sw.stop();
        return [
          {
            label: "ptyhostservice<->ptyhost",
            latency: sw.elapsed()
          },
          ...results
        ];
      }
      orphanQuestionReply(id2) {
        return this.f.orphanQuestionReply(id2);
      }
      installAutoReply(match, reply) {
        return this.f.installAutoReply(match, reply);
      }
      uninstallAllAutoReplies() {
        return this.f.uninstallAllAutoReplies();
      }
      getDefaultSystemShell(osOverride) {
        return this.g?.getDefaultSystemShell(osOverride) ?? $Ux(osOverride ?? OS, process.env);
      }
      async getProfiles(workspaceId, profiles, defaultProfile, includeDetectedProfiles = false) {
        const shellEnv = await this.S();
        return $LB(profiles, defaultProfile, includeDetectedProfiles, this.N, shellEnv, void 0, this.O, this.bb.bind(this, workspaceId));
      }
      async getEnvironment() {
        if (!this.b) {
          return { ...process.env };
        }
        return this.f.getEnvironment();
      }
      getWslPath(original, direction) {
        return this.f.getWslPath(original, direction);
      }
      getRevivedPtyNewId(workspaceId, id2) {
        return this.f.getRevivedPtyNewId(workspaceId, id2);
      }
      setTerminalLayoutInfo(args) {
        return this.f.setTerminalLayoutInfo(args);
      }
      async getTerminalLayoutInfo(args) {
        return this.g?.getTerminalLayoutInfo(args);
      }
      async requestDetachInstance(workspaceId, instanceId) {
        return this.f.requestDetachInstance(workspaceId, instanceId);
      }
      async acceptDetachInstanceReply(requestId, persistentProcessId) {
        return this.f.acceptDetachInstanceReply(requestId, persistentProcessId);
      }
      async freePortKillProcess(port) {
        if (!this.f.freePortKillProcess) {
          throw new Error("freePortKillProcess does not exist on the pty proxy");
        }
        return this.f.freePortKillProcess(port);
      }
      async serializeTerminalState(ids) {
        return this.f.serializeTerminalState(ids);
      }
      async reviveTerminalProcesses(workspaceId, state, dateTimeFormatLocate) {
        return this.f.reviveTerminalProcesses(workspaceId, state, dateTimeFormatLocate);
      }
      async refreshProperty(id2, property) {
        return this.f.refreshProperty(id2, property);
      }
      async updateProperty(id2, property, value) {
        return this.f.updateProperty(id2, property, value);
      }
      async restartPtyHost() {
        this.W();
        this.r = true;
        this.U();
      }
      W() {
        this.f.shutdownAll();
        this.c.store.dispose();
      }
      X(isConnecting) {
        this.ab();
        this.s = setTimeout(() => this.Y(), isConnecting ? HeartbeatConstants.ConnectingBeatInterval : HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier);
        if (!this.r) {
          this.r = true;
          this.z.fire();
        }
      }
      Y() {
        this.O.warn(`No ptyHost heartbeat after ${HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier / 1e3} seconds`);
        this.s = void 0;
        this.t = setTimeout(() => this.Z(), HeartbeatConstants.BeatInterval * HeartbeatConstants.SecondWaitMultiplier);
      }
      Z() {
        this.O.error(`No ptyHost heartbeat after ${(HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier + HeartbeatConstants.BeatInterval * HeartbeatConstants.FirstWaitMultiplier) / 1e3} seconds`);
        this.t = void 0;
        if (this.r) {
          this.r = false;
          this.y.fire();
        }
      }
      $() {
        this.ab();
        this.O.error(`No ptyHost response to createProcess after ${HeartbeatConstants.CreateProcessTimeout / 1e3} seconds`);
        if (this.r) {
          this.r = false;
          this.y.fire();
        }
      }
      ab() {
        if (this.s) {
          clearTimeout(this.s);
          this.s = void 0;
        }
        if (this.t) {
          clearTimeout(this.t);
          this.t = void 0;
        }
      }
      bb(workspaceId, text) {
        return this.j.createRequest({ workspaceId, originalText: text });
      }
      async acceptPtyHostResolvedVariables(requestId, resolved) {
        this.j.acceptReply(requestId, resolved);
      }
    };
    $MB = __decorate([
      __param(1, $kl),
      __param(2, $wn),
      __param(3, $xn)
    ], $MB);
  }
});

// out-build/vs/workbench/api/node/uriTransformer.js
function createRawURITransformer(remoteAuthority) {
  return {
    transformIncoming: (uri) => {
      if (uri.scheme === "vscode-remote") {
        return { scheme: "file", path: uri.path, query: uri.query, fragment: uri.fragment };
      }
      if (uri.scheme === "file") {
        return { scheme: "vscode-local", path: uri.path, query: uri.query, fragment: uri.fragment };
      }
      return uri;
    },
    transformOutgoing: (uri) => {
      if (uri.scheme === "file") {
        return { scheme: "vscode-remote", authority: remoteAuthority, path: uri.path, query: uri.query, fragment: uri.fragment };
      }
      if (uri.scheme === "vscode-local") {
        return { scheme: "file", path: uri.path, query: uri.query, fragment: uri.fragment };
      }
      return uri;
    },
    transformOutgoingScheme: (scheme) => {
      if (scheme === "file") {
        return "vscode-remote";
      } else if (scheme === "vscode-local") {
        return "file";
      }
      return scheme;
    }
  };
}
function $FX(remoteAuthority) {
  return new $ry(createRawURITransformer(remoteAuthority));
}
var init_uriTransformer = __esm({
  "out-build/vs/workbench/api/node/uriTransformer.js"() {
    "use strict";
    init_uriIpc();
  }
});

// out-build/vs/base/node/ps.js
import { exec as exec2 } from "child_process";
function $Ay(rootPid) {
  return new Promise((resolve4, reject) => {
    let rootItem;
    const map = /* @__PURE__ */ new Map();
    function addToTree(pid, ppid, cmd, load, mem) {
      const parent = map.get(ppid);
      if (pid === rootPid || parent) {
        const item = {
          name: findName(cmd),
          cmd,
          pid,
          ppid,
          load,
          mem
        };
        map.set(pid, item);
        if (pid === rootPid) {
          rootItem = item;
        }
        if (parent) {
          if (!parent.children) {
            parent.children = [];
          }
          parent.children.push(item);
          if (parent.children.length > 1) {
            parent.children = parent.children.sort((a, b) => a.pid - b.pid);
          }
        }
      }
    }
    function findName(cmd) {
      const UTILITY_NETWORK_HINT = /--utility-sub-type=network/i;
      const WINDOWS_CRASH_REPORTER = /--crashes-directory/i;
      const WINPTY = /\\pipe\\winpty-control/i;
      const CONPTY = /conhost\.exe.+--headless/i;
      const TYPE = /--type=([a-zA-Z-]+)/;
      if (WINDOWS_CRASH_REPORTER.exec(cmd)) {
        return "electron-crash-reporter";
      }
      if (WINPTY.exec(cmd)) {
        return "winpty-agent";
      }
      if (CONPTY.exec(cmd)) {
        return "conpty-agent";
      }
      let matches = TYPE.exec(cmd);
      if (matches && matches.length === 2) {
        if (matches[1] === "renderer") {
          return `window`;
        } else if (matches[1] === "utility") {
          if (UTILITY_NETWORK_HINT.exec(cmd)) {
            return "utility-network-service";
          }
          return "utility-process";
        } else if (matches[1] === "extensionHost") {
          return "extension-host";
        }
        return matches[1];
      }
      const JS = /[a-zA-Z-]+\.js/g;
      let result = "";
      do {
        matches = JS.exec(cmd);
        if (matches) {
          result += matches + " ";
        }
      } while (matches);
      if (result) {
        if (cmd.indexOf("node ") < 0 && cmd.indexOf("node.exe") < 0) {
          return `electron-nodejs (${result})`;
        }
      }
      return cmd;
    }
    if (process.platform === "win32") {
      const cleanUNCPrefix = (value) => {
        if (value.indexOf("\\\\?\\") === 0) {
          return value.substring(4);
        } else if (value.indexOf("\\??\\") === 0) {
          return value.substring(4);
        } else if (value.indexOf('"\\\\?\\') === 0) {
          return '"' + value.substring(5);
        } else if (value.indexOf('"\\??\\') === 0) {
          return '"' + value.substring(5);
        } else {
          return value;
        }
      };
      import("@vscode/windows-process-tree").then((windowsProcessTree) => {
        windowsProcessTree.getProcessList(rootPid, (processList) => {
          if (!processList) {
            reject(new Error(`Root process ${rootPid} not found`));
            return;
          }
          windowsProcessTree.getProcessCpuUsage(processList, (completeProcessList) => {
            const processItems = /* @__PURE__ */ new Map();
            completeProcessList.forEach((process2) => {
              const commandLine = cleanUNCPrefix(process2.commandLine || "");
              processItems.set(process2.pid, {
                name: findName(commandLine),
                cmd: commandLine,
                pid: process2.pid,
                ppid: process2.ppid,
                load: process2.cpu || 0,
                mem: process2.memory || 0
              });
            });
            rootItem = processItems.get(rootPid);
            if (rootItem) {
              processItems.forEach((item) => {
                const parent = processItems.get(item.ppid);
                if (parent) {
                  if (!parent.children) {
                    parent.children = [];
                  }
                  parent.children.push(item);
                }
              });
              processItems.forEach((item) => {
                if (item.children) {
                  item.children = item.children.sort((a, b) => a.pid - b.pid);
                }
              });
              resolve4(rootItem);
            } else {
              reject(new Error(`Root process ${rootPid} not found`));
            }
          });
        }, windowsProcessTree.ProcessDataFlag.CommandLine | windowsProcessTree.ProcessDataFlag.Memory);
      });
    } else {
      let calculateLinuxCpuUsage2 = function() {
        let processes = [rootItem];
        const pids = [];
        while (processes.length) {
          const process2 = processes.shift();
          if (process2) {
            pids.push(process2.pid);
            if (process2.children) {
              processes = processes.concat(process2.children);
            }
          }
        }
        let cmd = JSON.stringify($ih.asFileUri("vs/base/node/cpuUsage.sh").fsPath);
        cmd += " " + pids.join(" ");
        exec2(cmd, {}, (err, stdout, stderr) => {
          if (err || stderr) {
            reject(err || new Error(stderr.toString()));
          } else {
            const cpuUsage = stdout.toString().split("\n");
            for (let i = 0; i < pids.length; i++) {
              const processInfo = map.get(pids[i]);
              processInfo.load = parseFloat(cpuUsage[i]);
            }
            if (!rootItem) {
              reject(new Error(`Root process ${rootPid} not found`));
              return;
            }
            resolve4(rootItem);
          }
        });
      };
      var calculateLinuxCpuUsage = calculateLinuxCpuUsage2;
      exec2("which ps", {}, (err, stdout, stderr) => {
        if (err || stderr) {
          if (process.platform !== "linux") {
            reject(err || new Error(stderr.toString()));
          } else {
            const cmd = JSON.stringify($ih.asFileUri("vs/base/node/ps.sh").fsPath);
            exec2(cmd, {}, (err2, stdout2, stderr2) => {
              if (err2 || stderr2) {
                reject(err2 || new Error(stderr2.toString()));
              } else {
                parsePsOutput(stdout2, addToTree);
                calculateLinuxCpuUsage2();
              }
            });
          }
        } else {
          const ps = stdout.toString().trim();
          const args = "-ax -o pid=,ppid=,pcpu=,pmem=,command=";
          exec2(`${ps} ${args}`, { maxBuffer: 1e3 * 1024, env: { LC_NUMERIC: "en_US.UTF-8" } }, (err2, stdout2, stderr2) => {
            if (err2 || stderr2 && !stderr2.includes("screen size is bogus")) {
              reject(err2 || new Error(stderr2.toString()));
            } else {
              parsePsOutput(stdout2, addToTree);
              if (process.platform === "linux") {
                calculateLinuxCpuUsage2();
              } else {
                if (!rootItem) {
                  reject(new Error(`Root process ${rootPid} not found`));
                } else {
                  resolve4(rootItem);
                }
              }
            }
          });
        }
      });
    }
  });
}
function parsePsOutput(stdout, addToTree) {
  const PID_CMD = /^\s*([0-9]+)\s+([0-9]+)\s+([0-9]+\.[0-9]+)\s+([0-9]+\.[0-9]+)\s+(.+)$/;
  const lines = stdout.toString().split("\n");
  for (const line of lines) {
    const matches = PID_CMD.exec(line.trim());
    if (matches && matches.length === 6) {
      addToTree(parseInt(matches[1]), parseInt(matches[2]), matches[5], parseFloat(matches[3]), parseFloat(matches[4]));
    }
  }
}
var init_ps = __esm({
  "out-build/vs/base/node/ps.js"() {
    "use strict";
    init_network();
  }
});

// out-build/vs/platform/diagnostics/common/diagnostics.js
function $Ix(x) {
  return !!x.hostName && !!x.errorMessage;
}
var ID, $Hx;
var init_diagnostics = __esm({
  "out-build/vs/platform/diagnostics/common/diagnostics.js"() {
    "use strict";
    init_instantiation();
    ID = "diagnosticsService";
    $Hx = $Qk(ID);
  }
});

// out-build/vs/platform/diagnostics/node/diagnosticsService.js
import * as fs10 from "fs";
import * as osLib from "os";
async function $3B(folder, filter) {
  const cacheKey = `${folder}::${filter.join(":")}`;
  const cached = workspaceStatsCache.get(cacheKey);
  if (cached) {
    return cached;
  }
  const configFilePatterns = [
    { tag: "grunt.js", filePattern: /^gruntfile\.js$/i },
    { tag: "gulp.js", filePattern: /^gulpfile\.js$/i },
    { tag: "tsconfig.json", filePattern: /^tsconfig\.json$/i },
    { tag: "package.json", filePattern: /^package\.json$/i },
    { tag: "jsconfig.json", filePattern: /^jsconfig\.json$/i },
    { tag: "tslint.json", filePattern: /^tslint\.json$/i },
    { tag: "eslint.json", filePattern: /^eslint\.json$/i },
    { tag: "tasks.json", filePattern: /^tasks\.json$/i },
    { tag: "launch.json", filePattern: /^launch\.json$/i },
    { tag: "settings.json", filePattern: /^settings\.json$/i },
    { tag: "webpack.config.js", filePattern: /^webpack\.config\.js$/i },
    { tag: "project.json", filePattern: /^project\.json$/i },
    { tag: "makefile", filePattern: /^makefile$/i },
    { tag: "sln", filePattern: /^.+\.sln$/i },
    { tag: "csproj", filePattern: /^.+\.csproj$/i },
    { tag: "cmake", filePattern: /^.+\.cmake$/i },
    { tag: "github-actions", filePattern: /^.+\.ya?ml$/i, relativePathPattern: /^\.github(?:\/|\\)workflows$/i },
    { tag: "devcontainer.json", filePattern: /^devcontainer\.json$/i },
    { tag: "dockerfile", filePattern: /^(dockerfile|docker\-compose\.ya?ml)$/i },
    { tag: "cursorrules", filePattern: /^\.cursorrules$/i }
  ];
  const fileTypes = /* @__PURE__ */ new Map();
  const configFiles = /* @__PURE__ */ new Map();
  const MAX_FILES = 2e4;
  function collect(root, dir, filter2, token) {
    const relativePath = dir.substring(root.length + 1);
    return Promises.withAsyncBody(async (resolve4) => {
      let files;
      token.readdirCount++;
      try {
        files = await Promises2.readdir(dir, { withFileTypes: true });
      } catch (error) {
        resolve4();
        return;
      }
      if (token.count >= MAX_FILES) {
        token.count += files.length;
        token.maxReached = true;
        resolve4();
        return;
      }
      let pending = files.length;
      if (pending === 0) {
        resolve4();
        return;
      }
      let filesToRead = files;
      if (token.count + files.length > MAX_FILES) {
        token.maxReached = true;
        pending = MAX_FILES - token.count;
        filesToRead = files.slice(0, pending);
      }
      token.count += files.length;
      for (const file of filesToRead) {
        if (file.isDirectory()) {
          if (!filter2.includes(file.name)) {
            await collect(root, $nc(dir, file.name), filter2, token);
          }
          if (--pending === 0) {
            resolve4();
            return;
          }
        } else {
          const index = file.name.lastIndexOf(".");
          if (index >= 0) {
            const fileType = file.name.substring(index + 1);
            if (fileType) {
              fileTypes.set(fileType, (fileTypes.get(fileType) ?? 0) + 1);
            }
          }
          for (const configFile of configFilePatterns) {
            if (configFile.relativePathPattern?.test(relativePath) !== false && configFile.filePattern.test(file.name)) {
              configFiles.set(configFile.tag, (configFiles.get(configFile.tag) ?? 0) + 1);
            }
          }
          if (--pending === 0) {
            resolve4();
            return;
          }
        }
      }
    });
  }
  const statsPromise = Promises.withAsyncBody(async (resolve4) => {
    const token = { count: 0, maxReached: false, readdirCount: 0 };
    const sw = new $te(true);
    await collect(folder, folder, filter, token);
    const launchConfigs = await $5B(folder);
    resolve4({
      configFiles: asSortedItems(configFiles),
      fileTypes: asSortedItems(fileTypes),
      fileCount: token.count,
      maxFilesReached: token.maxReached,
      launchConfigFiles: launchConfigs,
      totalScanTime: sw.elapsed(),
      totalReaddirCount: token.readdirCount
    });
  });
  workspaceStatsCache.set(cacheKey, statsPromise);
  return statsPromise;
}
function asSortedItems(items) {
  return Array.from(items.entries(), ([name, count]) => ({ name, count })).sort((a, b) => b.count - a.count);
}
function $4B() {
  const machineInfo = {
    os: `${osLib.type()} ${osLib.arch()} ${osLib.release()}`,
    memory: `${(osLib.totalmem() / $Sm.GB).toFixed(2)}GB (${(osLib.freemem() / $Sm.GB).toFixed(2)}GB free)`,
    vmHint: `${Math.round($Ey.value() * 100)}%`
  };
  const cpus2 = osLib.cpus();
  if (cpus2 && cpus2.length > 0) {
    machineInfo.cpus = `${cpus2[0].model} (${cpus2.length} x ${cpus2[0].speed})`;
  }
  return machineInfo;
}
async function $5B(folder) {
  try {
    const launchConfigs = /* @__PURE__ */ new Map();
    const launchConfig = $nc(folder, ".vscode", "launch.json");
    const contents = await fs10.promises.readFile(launchConfig);
    const errors = [];
    const json = $yw(contents.toString(), errors);
    if (errors.length) {
      console.log(`Unable to parse ${launchConfig}`);
      return [];
    }
    if ($Gw(json) === "object" && json["configurations"]) {
      for (const each of json["configurations"]) {
        const type2 = each["type"];
        if (type2) {
          if (launchConfigs.has(type2)) {
            launchConfigs.set(type2, launchConfigs.get(type2) + 1);
          } else {
            launchConfigs.set(type2, 1);
          }
        }
      }
    }
    return asSortedItems(launchConfigs);
  } catch (error) {
    return [];
  }
}
var workspaceStatsCache, $6B;
var init_diagnosticsService = __esm({
  "out-build/vs/platform/diagnostics/node/diagnosticsService.js"() {
    "use strict";
    init_async();
    init_json();
    init_network();
    init_path();
    init_platform();
    init_stopwatch();
    init_uri();
    init_id();
    init_pfs();
    init_ps();
    init_diagnostics();
    init_files();
    init_productService();
    init_telemetry();
    workspaceStatsCache = /* @__PURE__ */ new Map();
    $6B = class $6B2 {
      constructor(c, d) {
        this.c = c;
        this.d = d;
      }
      f(info) {
        const output = [];
        output.push(`OS Version:       ${info.os}`);
        output.push(`CPUs:             ${info.cpus}`);
        output.push(`Memory (System):  ${info.memory}`);
        output.push(`VM:               ${info.vmHint}`);
        return output.join("\n");
      }
      g(info) {
        const output = [];
        output.push(`Version:          ${this.d.nameShort} ${this.d.version} (${this.d.commit || "Commit unknown"}, ${this.d.date || "Date unknown"})`);
        output.push(`OS Version:       ${osLib.type()} ${osLib.arch()} ${osLib.release()}`);
        const cpus2 = osLib.cpus();
        if (cpus2 && cpus2.length > 0) {
          output.push(`CPUs:             ${cpus2[0].model} (${cpus2.length} x ${cpus2[0].speed})`);
        }
        output.push(`Memory (System):  ${(osLib.totalmem() / $Sm.GB).toFixed(2)}GB (${(osLib.freemem() / $Sm.GB).toFixed(2)}GB free)`);
        if (!$l) {
          output.push(`Load (avg):       ${osLib.loadavg().map((l) => Math.round(l)).join(", ")}`);
        }
        output.push(`VM:               ${Math.round($Ey.value() * 100)}%`);
        output.push(`Screen Reader:    ${info.screenReader ? "yes" : "no"}`);
        output.push(`Process Argv:     ${info.mainArguments.join(" ")}`);
        output.push(`GPU Status:       ${this.j(info.gpuFeatureStatus)}`);
        return output.join("\n");
      }
      async getPerformanceInfo(info, remoteData) {
        return Promise.all([$Ay(info.mainPID), this.k(info)]).then(async (result) => {
          let [rootProcess, workspaceInfo] = result;
          let processInfo = this.m(info, rootProcess);
          remoteData.forEach((diagnostics) => {
            if ($Ix(diagnostics)) {
              processInfo += `
${diagnostics.errorMessage}`;
              workspaceInfo += `
${diagnostics.errorMessage}`;
            } else {
              processInfo += `

Remote: ${diagnostics.hostName}`;
              if (diagnostics.processes) {
                processInfo += `
${this.m(info, diagnostics.processes)}`;
              }
              if (diagnostics.workspaceMetadata) {
                workspaceInfo += `
|  Remote: ${diagnostics.hostName}`;
                for (const folder of Object.keys(diagnostics.workspaceMetadata)) {
                  const metadata = diagnostics.workspaceMetadata[folder];
                  let countMessage = `${metadata.fileCount} files`;
                  if (metadata.maxFilesReached) {
                    countMessage = `more than ${countMessage}`;
                  }
                  workspaceInfo += `|    Folder (${folder}): ${countMessage}`;
                  workspaceInfo += this.h(metadata);
                }
              }
            }
          });
          return {
            processInfo,
            workspaceInfo
          };
        });
      }
      async getSystemInfo(info, remoteData) {
        const { memory, vmHint, os: os7, cpus: cpus2 } = $4B();
        const systemInfo = {
          os: os7,
          memory,
          cpus: cpus2,
          vmHint,
          processArgs: `${info.mainArguments.join(" ")}`,
          gpuStatus: info.gpuFeatureStatus,
          screenReader: `${info.screenReader ? "yes" : "no"}`,
          remoteData
        };
        if (!$l) {
          systemInfo.load = `${osLib.loadavg().map((l) => Math.round(l)).join(", ")}`;
        }
        if ($n) {
          systemInfo.linuxEnv = {
            desktopSession: process.env["DESKTOP_SESSION"],
            xdgSessionDesktop: process.env["XDG_SESSION_DESKTOP"],
            xdgCurrentDesktop: process.env["XDG_CURRENT_DESKTOP"],
            xdgSessionType: process.env["XDG_SESSION_TYPE"]
          };
        }
        return Promise.resolve(systemInfo);
      }
      async getDiagnostics(info, remoteDiagnostics) {
        const output = [];
        return $Ay(info.mainPID).then(async (rootProcess) => {
          output.push("");
          output.push(this.g(info));
          output.push("");
          output.push(this.m(info, rootProcess));
          if (info.windows.some((window2) => window2.folderURIs && window2.folderURIs.length > 0 && !window2.remoteAuthority)) {
            output.push("");
            output.push("Workspace Stats: ");
            output.push(await this.k(info));
          }
          remoteDiagnostics.forEach((diagnostics) => {
            if ($Ix(diagnostics)) {
              output.push(`
${diagnostics.errorMessage}`);
            } else {
              output.push("\n\n");
              output.push(`Remote:           ${diagnostics.hostName}`);
              output.push(this.f(diagnostics.machineInfo));
              if (diagnostics.processes) {
                output.push(this.m(info, diagnostics.processes));
              }
              if (diagnostics.workspaceMetadata) {
                for (const folder of Object.keys(diagnostics.workspaceMetadata)) {
                  const metadata = diagnostics.workspaceMetadata[folder];
                  let countMessage = `${metadata.fileCount} files`;
                  if (metadata.maxFilesReached) {
                    countMessage = `more than ${countMessage}`;
                  }
                  output.push(`Folder (${folder}): ${countMessage}`);
                  output.push(this.h(metadata));
                }
              }
            }
          });
          output.push("");
          output.push("");
          return output.join("\n");
        });
      }
      h(workspaceStats) {
        const output = [];
        const lineLength = 60;
        let col = 0;
        const appendAndWrap = (name, count) => {
          const item = ` ${name}(${count})`;
          if (col + item.length > lineLength) {
            output.push(line);
            line = "|                 ";
            col = line.length;
          } else {
            col += item.length;
          }
          line += item;
        };
        let line = "|      File types:";
        const maxShown = 10;
        const max = workspaceStats.fileTypes.length > maxShown ? maxShown : workspaceStats.fileTypes.length;
        for (let i = 0; i < max; i++) {
          const item = workspaceStats.fileTypes[i];
          appendAndWrap(item.name, item.count);
        }
        output.push(line);
        if (workspaceStats.configFiles.length >= 0) {
          line = "|      Conf files:";
          col = 0;
          workspaceStats.configFiles.forEach((item) => {
            appendAndWrap(item.name, item.count);
          });
          output.push(line);
        }
        if (workspaceStats.launchConfigFiles.length > 0) {
          let line2 = "|      Launch Configs:";
          workspaceStats.launchConfigFiles.forEach((each) => {
            const item = each.count > 1 ? ` ${each.name}(${each.count})` : ` ${each.name}`;
            line2 += item;
          });
          output.push(line2);
        }
        return output.join("\n");
      }
      j(gpuFeatures) {
        const longestFeatureName = Math.max(...Object.keys(gpuFeatures).map((feature) => feature.length));
        return Object.keys(gpuFeatures).map((feature) => `${feature}:  ${" ".repeat(longestFeatureName - feature.length)}  ${gpuFeatures[feature]}`).join("\n                  ");
      }
      k(info) {
        const output = [];
        const workspaceStatPromises = [];
        info.windows.forEach((window2) => {
          if (window2.folderURIs.length === 0 || !!window2.remoteAuthority) {
            return;
          }
          output.push(`|  Window (${window2.title})`);
          window2.folderURIs.forEach((uriComponents) => {
            const folderUri = URI.revive(uriComponents);
            if (folderUri.scheme === Schemas.file) {
              const folder = folderUri.fsPath;
              workspaceStatPromises.push($3B(folder, ["node_modules", ".git"]).then((stats) => {
                let countMessage = `${stats.fileCount} files`;
                if (stats.maxFilesReached) {
                  countMessage = `more than ${countMessage}`;
                }
                output.push(`|    Folder (${$rc(folder)}): ${countMessage}`);
                output.push(this.h(stats));
              }).catch((error) => {
                output.push(`|      Error: Unable to collect workspace stats for folder ${folder} (${error.toString()})`);
              }));
            } else {
              output.push(`|    Folder (${folderUri.toString()}): Workspace stats not available.`);
            }
          });
        });
        return Promise.all(workspaceStatPromises).then((_) => output.join("\n")).catch((e) => `Unable to collect workspace stats: ${e}`);
      }
      m(info, rootProcess) {
        const mapProcessToName = /* @__PURE__ */ new Map();
        info.windows.forEach((window2) => mapProcessToName.set(window2.pid, `window [${window2.id}] (${window2.title})`));
        info.pidToNames.forEach(({ pid, name }) => mapProcessToName.set(pid, name));
        const output = [];
        output.push("CPU %	Mem MB	   PID	Process");
        if (rootProcess) {
          this.n(info.mainPID, mapProcessToName, output, rootProcess, 0);
        }
        return output.join("\n");
      }
      n(mainPid, mapProcessToName, output, item, indent2) {
        const isRoot = indent2 === 0;
        let name;
        if (isRoot) {
          name = item.pid === mainPid ? `${this.d.applicationName} main` : "remote agent";
        } else {
          if (mapProcessToName.has(item.pid)) {
            name = mapProcessToName.get(item.pid);
          } else {
            name = `${"  ".repeat(indent2)} ${item.name}`;
          }
        }
        const memory = process.platform === "win32" ? item.mem : osLib.totalmem() * (item.mem / 100);
        output.push(`${item.load.toFixed(0).padStart(5, " ")}	${(memory / $Sm.MB).toFixed(0).padStart(6, " ")}	${item.pid.toFixed(0).padStart(6, " ")}	${name}`);
        if (Array.isArray(item.children)) {
          item.children.forEach((child) => this.n(mainPid, mapProcessToName, output, child, indent2 + 1));
        }
      }
      async getWorkspaceFileExtensions(workspace) {
        const items = /* @__PURE__ */ new Set();
        for (const { uri } of workspace.folders) {
          const folderUri = URI.revive(uri);
          if (folderUri.scheme !== Schemas.file) {
            continue;
          }
          const folder = folderUri.fsPath;
          try {
            const stats = await $3B(folder, ["node_modules", ".git"]);
            stats.fileTypes.forEach((item) => items.add(item.name));
          } catch {
          }
        }
        return { extensions: [...items] };
      }
      async reportWorkspaceStats(workspace) {
        for (const { uri } of workspace.folders) {
          const folderUri = URI.revive(uri);
          if (folderUri.scheme !== Schemas.file) {
            continue;
          }
          const folder = folderUri.fsPath;
          try {
            const stats = await $3B(folder, ["node_modules", ".git"]);
            this.c.publicLog2("workspace.stats", {
              "workspace.id": workspace.telemetryId,
              rendererSessionId: workspace.rendererSessionId
            });
            stats.fileTypes.forEach((e) => {
              this.c.publicLog2("workspace.stats.file", {
                rendererSessionId: workspace.rendererSessionId,
                type: e.name,
                count: e.count
              });
            });
            stats.launchConfigFiles.forEach((e) => {
              this.c.publicLog2("workspace.stats.launchConfigFile", {
                rendererSessionId: workspace.rendererSessionId,
                type: e.name,
                count: e.count
              });
            });
            stats.configFiles.forEach((e) => {
              this.c.publicLog2("workspace.stats.configFiles", {
                rendererSessionId: workspace.rendererSessionId,
                type: e.name,
                count: e.count
              });
            });
            this.c.publicLog2("workspace.stats.metadata", { duration: stats.totalScanTime, reachedLimit: stats.maxFilesReached, fileCount: stats.fileCount, readdirCount: stats.totalReaddirCount });
          } catch {
          }
        }
      }
    };
    $6B = __decorate([
      __param(0, $zv),
      __param(1, $Vu)
    ], $6B);
  }
});

// out-build/vs/server/node/remoteAgentEnvironmentImpl.js
var $HX;
var init_remoteAgentEnvironmentImpl = __esm({
  "out-build/vs/server/node/remoteAgentEnvironmentImpl.js"() {
    "use strict";
    init_platform();
    init_performance();
    init_uri();
    init_uriTransformer();
    init_uriIpc();
    init_ps();
    init_diagnosticsService();
    init_path();
    init_resources();
    $HX = class _$HX {
      static {
        this.a = 1;
      }
      constructor(b, c, d, e) {
        this.b = b;
        this.c = c;
        this.d = d;
        this.e = e;
      }
      async call(_, command, arg) {
        switch (command) {
          case "getEnvironmentData": {
            const args = arg;
            const uriTransformer = $FX(args.remoteAuthority);
            let environmentData = await this.f(args.profile);
            environmentData = $ty(environmentData, uriTransformer);
            return environmentData;
          }
          case "getExtensionHostExitInfo": {
            const args = arg;
            return this.e.getExitInfo(args.reconnectionToken);
          }
          case "getDiagnosticInfo": {
            const options2 = arg;
            const diagnosticInfo = {
              machineInfo: $4B()
            };
            const processesPromise = options2.includeProcesses ? $Ay(process.pid) : Promise.resolve();
            let workspaceMetadataPromises = [];
            const workspaceMetadata = {};
            if (options2.folders) {
              const uriTransformer = $FX("");
              const folderPaths = options2.folders.map((folder) => URI.revive(uriTransformer.transformIncoming(folder))).filter((uri) => uri.scheme === "file");
              workspaceMetadataPromises = folderPaths.map((folder) => {
                return $3B(folder.fsPath, ["node_modules", ".git"]).then((stats) => {
                  workspaceMetadata[$rc(folder.fsPath)] = stats;
                });
              });
            }
            return Promise.all([processesPromise, ...workspaceMetadataPromises]).then(([processes, _2]) => {
              diagnosticInfo.processes = processes || void 0;
              diagnosticInfo.workspaceMetadata = options2.folders ? workspaceMetadata : void 0;
              return diagnosticInfo;
            });
          }
        }
        throw new Error(`IPC Command ${command} not found`);
      }
      listen(_, event, arg) {
        throw new Error("Not supported");
      }
      async f(profile) {
        if (profile && !this.d.profiles.some((p) => p.id === profile)) {
          await this.d.createProfile(profile, profile);
        }
        let isUnsupportedGlibc = false;
        if (process.platform === "linux") {
          const glibcVersion = process.glibcVersion;
          const minorVersion = glibcVersion ? parseInt(glibcVersion.split(".")[1]) : 28;
          isUnsupportedGlibc = minorVersion <= 27;
        }
        return {
          pid: process.pid,
          connectionToken: this.b.type !== 0 ? this.b.value : "",
          appRoot: URI.file(this.c.appRoot),
          settingsPath: this.c.machineSettingsResource,
          logsPath: this.c.logsHome,
          extensionHostLogsPath: $vh(this.c.logsHome, `exthost${_$HX.a++}`),
          globalStorageHome: this.d.defaultProfile.globalStorageHome,
          workspaceStorageHome: this.c.workspaceStorageHome,
          localHistoryHome: this.c.localHistoryHome,
          userHome: this.c.userHome,
          os: OS,
          arch: process.arch,
          marks: $T(),
          useHostProxy: !!this.c.args["use-host-proxy"],
          profiles: {
            home: this.d.profilesHome,
            all: [...this.d.profiles].map((profile2) => ({ ...profile2 }))
          },
          isUnsupportedGlibc
        };
      }
    };
  }
});

// out-build/vs/platform/files/node/diskFileSystemProviderServer.js
var $wy, $xy;
var init_diskFileSystemProviderServer = __esm({
  "out-build/vs/platform/files/node/diskFileSystemProviderServer.js"() {
    "use strict";
    init_event();
    init_diskFileSystemProvider2();
    init_lifecycle();
    init_buffer();
    init_stream();
    init_cancellation();
    $wy = class extends $3c {
      constructor(a, b) {
        super();
        this.a = a;
        this.b = b;
        this.F = /* @__PURE__ */ new Map();
        this.G = /* @__PURE__ */ new Map();
      }
      call(ctx, command, arg) {
        const uriTransformer = this.c(ctx);
        switch (command) {
          case "stat":
            return this.g(uriTransformer, arg[0]);
          case "readdir":
            return this.h(uriTransformer, arg[0]);
          case "open":
            return this.r(uriTransformer, arg[0], arg[1]);
          case "close":
            return this.s(arg[0]);
          case "read":
            return this.t(arg[0], arg[1], arg[2]);
          case "readFile":
            return this.j(uriTransformer, arg[0], arg[1]);
          case "write":
            return this.u(arg[0], arg[1], arg[2], arg[3], arg[4]);
          case "writeFile":
            return this.n(uriTransformer, arg[0], arg[1], arg[2]);
          case "rename":
            return this.z(uriTransformer, arg[0], arg[1], arg[2]);
          case "copy":
            return this.C(uriTransformer, arg[0], arg[1], arg[2]);
          case "cloneFile":
            return this.D(uriTransformer, arg[0], arg[1]);
          case "mkdir":
            return this.w(uriTransformer, arg[0]);
          case "delete":
            return this.y(uriTransformer, arg[0], arg[1]);
          case "watch":
            return this.I(uriTransformer, arg[0], arg[1], arg[2], arg[3]);
          case "unwatch":
            return this.J(arg[0], arg[1]);
        }
        throw new Error(`IPC Command ${command} not found`);
      }
      listen(ctx, event, arg) {
        const uriTransformer = this.c(ctx);
        switch (event) {
          case "fileChange":
            return this.H(uriTransformer, arg[0]);
          case "readFileStream":
            return this.m(uriTransformer, arg[0], arg[1]);
        }
        throw new Error(`Unknown event ${event}`);
      }
      //#region File Metadata Resolving
      g(uriTransformer, _resource) {
        const resource = this.f(uriTransformer, _resource, true);
        return this.a.stat(resource);
      }
      h(uriTransformer, _resource) {
        const resource = this.f(uriTransformer, _resource);
        return this.a.readdir(resource);
      }
      //#endregion
      //#region File Reading/Writing
      async j(uriTransformer, _resource, opts) {
        const resource = this.f(uriTransformer, _resource, true);
        this.b.trace(`File action: readFile ${resource.path}`);
        const buffer = await this.a.readFile(resource, opts);
        return $Ci.wrap(buffer);
      }
      m(uriTransformer, _resource, opts) {
        const resource = this.f(uriTransformer, _resource, true);
        const cts = new $ad();
        const emitter = new $ze({
          onDidRemoveLastListener: () => {
            cts.cancel();
          }
        });
        this.b.trace(`File action: readFileStream ${resource.path}`);
        const fileStream = this.a.readFileStream(resource, opts, cts.token);
        $ui(fileStream, {
          onData: (chunk) => emitter.fire($Ci.wrap(chunk)),
          onError: (error) => emitter.fire(error),
          onEnd: () => {
            emitter.fire("end");
            emitter.dispose();
            cts.dispose();
          }
        });
        return emitter.event;
      }
      n(uriTransformer, _resource, content, opts) {
        const resource = this.f(uriTransformer, _resource);
        this.b.trace(`File action: writeFile ${resource.path}`);
        return this.a.writeFile(resource, content.buffer, opts);
      }
      r(uriTransformer, _resource, opts) {
        const resource = this.f(uriTransformer, _resource, true);
        return this.a.open(resource, opts);
      }
      s(fd) {
        return this.a.close(fd);
      }
      async t(fd, pos, length) {
        const buffer = $Ci.alloc(length);
        const bufferOffset = 0;
        const bytesRead = await this.a.read(fd, pos, buffer.buffer, bufferOffset, length);
        return [buffer, bytesRead];
      }
      u(fd, pos, data, offset, length) {
        return this.a.write(fd, pos, data.buffer, offset, length);
      }
      //#endregion
      //#region Move/Copy/Delete/Create Folder
      w(uriTransformer, _resource) {
        const resource = this.f(uriTransformer, _resource);
        return this.a.mkdir(resource);
      }
      y(uriTransformer, _resource, opts) {
        const resource = this.f(uriTransformer, _resource);
        return this.a.delete(resource, opts);
      }
      z(uriTransformer, _source, _target, opts) {
        const source = this.f(uriTransformer, _source);
        const target = this.f(uriTransformer, _target);
        return this.a.rename(source, target, opts);
      }
      C(uriTransformer, _source, _target, opts) {
        const source = this.f(uriTransformer, _source);
        const target = this.f(uriTransformer, _target);
        return this.a.copy(source, target, opts);
      }
      //#endregion
      //#region Clone File
      D(uriTransformer, _source, _target) {
        const source = this.f(uriTransformer, _source);
        const target = this.f(uriTransformer, _target);
        return this.a.cloneFile(source, target);
      }
      H(uriTransformer, sessionId) {
        const emitter = new $ze({
          onWillAddFirstListener: () => {
            this.F.set(sessionId, this.L(uriTransformer, emitter));
          },
          onDidRemoveLastListener: () => {
            $Xc(this.F.get(sessionId));
            this.F.delete(sessionId);
          }
        });
        return emitter.event;
      }
      async I(uriTransformer, sessionId, req, _resource, opts) {
        const watcher = this.F.get(sessionId);
        if (watcher) {
          const resource = this.f(uriTransformer, _resource);
          const disposable = watcher.watch(req, resource, opts);
          this.G.set(sessionId + req, disposable);
        }
      }
      async J(sessionId, req) {
        const id2 = sessionId + req;
        const disposable = this.G.get(id2);
        if (disposable) {
          $Xc(disposable);
          this.G.delete(id2);
        }
      }
      //#endregion
      dispose() {
        super.dispose();
        for (const [, disposable] of this.G) {
          disposable.dispose();
        }
        this.G.clear();
        for (const [, disposable] of this.F) {
          disposable.dispose();
        }
        this.F.clear();
      }
    };
    $xy = class extends $3c {
      constructor(c, sessionEmitter, f, g) {
        super();
        this.c = c;
        this.f = f;
        this.g = g;
        this.a = /* @__PURE__ */ new Map();
        this.b = this.B(new $qy(this.f));
        this.h(sessionEmitter);
      }
      h(sessionEmitter) {
        const localChangeEmitter = this.B(new $ze());
        this.B(localChangeEmitter.event((events) => {
          sessionEmitter.fire(events.map((e) => ({
            resource: this.c.transformOutgoingURI(e.resource),
            type: e.type,
            cId: e.cId
          })));
        }));
        this.B(this.b.onDidChangeFile((events) => localChangeEmitter.fire(events)));
        this.B(this.b.onDidWatchError((error) => sessionEmitter.fire(error)));
      }
      j(environmentService) {
        return void 0;
      }
      m(environmentService) {
        return void 0;
      }
      watch(req, resource, opts) {
        const extraExcludes = this.m(this.g);
        if (Array.isArray(extraExcludes)) {
          opts.excludes = [...opts.excludes, ...extraExcludes];
        }
        this.a.set(req, this.b.watch(resource, opts));
        return $1c(() => {
          $Xc(this.a.get(req));
          this.a.delete(req);
        });
      }
      dispose() {
        for (const [, disposable] of this.a) {
          disposable.dispose();
        }
        this.a.clear();
        super.dispose();
      }
    };
  }
});

// out-build/vs/server/node/remoteFileSystemProviderServer.js
var $IX, SessionFileWatcher;
var init_remoteFileSystemProviderServer = __esm({
  "out-build/vs/server/node/remoteFileSystemProviderServer.js"() {
    "use strict";
    init_uri();
    init_uriTransformer();
    init_diskFileSystemProvider2();
    init_path();
    init_diskFileSystemProviderServer();
    $IX = class extends $wy {
      constructor(logService, N, O) {
        super(new $qy(logService), logService);
        this.N = N;
        this.O = O;
        this.M = /* @__PURE__ */ new Map();
        this.B(this.a);
      }
      c(ctx) {
        let transformer = this.M.get(ctx.remoteAuthority);
        if (!transformer) {
          transformer = $FX(ctx.remoteAuthority);
          this.M.set(ctx.remoteAuthority, transformer);
        }
        return transformer;
      }
      f(uriTransformer, _resource, supportVSCodeResource = false) {
        if (supportVSCodeResource && _resource.path === "/vscode-resource" && _resource.query) {
          const requestResourcePath = JSON.parse(_resource.query).requestResourcePath;
          return URI.from({ scheme: "file", path: requestResourcePath });
        }
        return URI.revive(uriTransformer.transformIncoming(_resource));
      }
      //#region File Watching
      L(uriTransformer, emitter) {
        return new SessionFileWatcher(uriTransformer, emitter, this.b, this.N, this.O);
      }
    };
    SessionFileWatcher = class extends $xy {
      constructor(uriTransformer, sessionEmitter, logService, environmentService, configurationService) {
        super(uriTransformer, sessionEmitter, logService, environmentService);
      }
      j(environmentService) {
        const fileWatcherPolling = environmentService.args["file-watcher-polling"];
        if (fileWatcherPolling) {
          const segments = fileWatcherPolling.split($xc);
          const pollingInterval = Number(segments[0]);
          if (pollingInterval > 0) {
            const usePolling = segments.length > 1 ? segments.slice(1) : true;
            return { usePolling, pollingInterval };
          }
        }
        return void 0;
      }
      m(environmentService) {
        if (environmentService.extensionsPath) {
          return [$kc.join(environmentService.extensionsPath, "**")];
        }
        return void 0;
      }
    };
  }
});

// out-build/vs/platform/telemetry/common/remoteTelemetryChannel.js
var $MX;
var init_remoteTelemetryChannel = __esm({
  "out-build/vs/platform/telemetry/common/remoteTelemetryChannel.js"() {
    "use strict";
    init_lifecycle();
    $MX = class extends $3c {
      constructor(a, b) {
        super();
        this.a = a;
        this.b = b;
      }
      async call(_, command, arg) {
        switch (command) {
          case "updateTelemetryLevel": {
            const { telemetryLevel } = arg;
            return this.a.updateInjectedTelemetryLevel(telemetryLevel);
          }
          case "logTelemetry": {
            const { eventName, data } = arg;
            if (this.b) {
              return this.b.log(eventName, data);
            }
            return Promise.resolve();
          }
          case "flushTelemetry": {
            if (this.b) {
              return this.b.flush();
            }
            return Promise.resolve();
          }
          case "ping": {
            return;
          }
        }
        throw new Error(`IPC Command ${command} not found`);
      }
      listen(_, event, arg) {
        throw new Error("Not supported");
      }
      /**
       * Disposing the channel also disables the telemetryService as there is
       * no longer a way to control it
       */
      dispose() {
        this.a.updateInjectedTelemetryLevel(
          0
          /* TelemetryLevel.NONE */
        );
        super.dispose();
      }
    };
  }
});

// out-build/vs/platform/telemetry/common/telemetryService.js
function getTelemetryLevelSettingDescription() {
  const telemetryText = localize(2107, null, product_default.nameLong);
  const externalLinksStatement = !product_default.privacyStatementUrl ? localize(2108, null, "https://aka.ms/vscode-telemetry") : localize(2109, null, "https://aka.ms/vscode-telemetry", product_default.privacyStatementUrl);
  const restartString = !$r ? localize(2110, null) : "";
  const crashReportsHeader = localize(2111, null);
  const errorsHeader = localize(2112, null);
  const usageHeader = localize(2113, null);
  const telemetryTableDescription = localize(2114, null);
  const telemetryTable = `
|       | ${crashReportsHeader} | ${errorsHeader} | ${usageHeader} |
|:------|:---------------------:|:---------------:|:--------------:|
| all   |            \u2713          |        \u2713        |        \u2713       |
| error |            \u2713          |        \u2713        |        -       |
| crash |            \u2713          |        -        |        -       |
| off   |            -          |        -        |        -       |
`;
  const deprecatedSettingNote = localize(2115, null);
  const telemetryDescription = `
${telemetryText} ${externalLinksStatement} ${restartString}

&nbsp;

${telemetryTableDescription}
${telemetryTable}

&nbsp;

${deprecatedSettingNote}
`;
  return telemetryDescription;
}
var $tz;
var init_telemetryService = __esm({
  "out-build/vs/platform/telemetry/common/telemetryService.js"() {
    "use strict";
    init_lifecycle();
    init_objects();
    init_platform();
    init_strings();
    init_nls2();
    init_configuration();
    init_configurationRegistry();
    init_product();
    init_productService();
    init_platform2();
    init_telemetry();
    init_telemetryUtils();
    $tz = class $tz2 {
      static {
        this.IDLE_START_EVENT_NAME = "UserIdleStart";
      }
      static {
        this.IDLE_STOP_EVENT_NAME = "UserIdleStop";
      }
      constructor(config, k, l) {
        this.k = k;
        this.l = l;
        this.d = {};
        this.i = new $2c();
        this.j = [];
        this.b = config.appenders;
        this.c = config.commonProperties ?? /* @__PURE__ */ Object.create(null);
        this.sessionId = this.c["sessionID"];
        this.machineId = this.c["common.machineId"];
        this.sqmId = this.c["common.sqmId"];
        this.devDeviceId = this.c["common.devDeviceId"];
        this.firstSessionDate = this.c["common.firstSessionDate"];
        this.msftInternal = this.c["common.msftInternal"];
        this.f = config.piiPaths || [];
        this.g = 3;
        this.h = !!config.sendErrorTelemetry;
        this.j = [/(vscode-)?file:\/\/\/.*?\/resources\/app\//gi];
        for (const piiPath of this.f) {
          this.j.push(new RegExp($Af(piiPath), "gi"));
          if (piiPath.indexOf("\\") >= 0) {
            this.j.push(new RegExp($Af(piiPath.replace(/\\/g, "/")), "gi"));
          }
        }
        this.m();
        this.i.add(this.k.onDidChangeConfiguration((e) => {
          const affectsTelemetryConfig = e.affectsConfiguration($Iv) || e.affectsConfiguration($Kv) || e.affectsConfiguration($Jv);
          if (affectsTelemetryConfig) {
            this.m();
          }
        }));
      }
      setExperimentProperty(name, value) {
        this.d[name] = value;
      }
      m() {
        let level = $kw(this.k);
        const collectableTelemetry = this.l.enabledTelemetryLevels;
        if (collectableTelemetry) {
          this.h = this.sendErrorTelemetry ? collectableTelemetry.error : false;
          const maxCollectableTelemetryLevel = collectableTelemetry.usage ? 3 : collectableTelemetry.error ? 2 : 0;
          level = Math.min(level, maxCollectableTelemetryLevel);
        }
        this.g = level;
      }
      get sendErrorTelemetry() {
        return this.h;
      }
      get telemetryLevel() {
        return this.g;
      }
      dispose() {
        this.i.dispose();
      }
      n(eventName, eventLevel, data) {
        if (this.g < eventLevel) {
          return;
        }
        data = $Ov(data, this.d);
        data = $pw(data, this.j);
        data = $Ov(data, this.c);
        this.b.forEach((a) => a.log(eventName, data));
      }
      publicLog(eventName, data) {
        this.n(eventName, 3, data);
      }
      publicLog2(eventName, data) {
        this.publicLog(eventName, data);
      }
      publicLogError(errorEventName, data) {
        if (!this.h) {
          return;
        }
        this.n(errorEventName, 2, data);
      }
      publicLogError2(eventName, data) {
        this.publicLogError(eventName, data);
      }
    };
    $tz = __decorate([
      __param(1, $kl),
      __param(2, $Vu)
    ], $tz);
    $Wn.as($Ht.Configuration).registerConfiguration({
      "id": $Hv,
      "order": 1,
      "type": "object",
      "title": localize(2116, null),
      "properties": {
        [$Iv]: {
          "type": "string",
          "enum": [
            "all",
            "error",
            "crash",
            "off"
            /* TelemetryConfiguration.OFF */
          ],
          "enumDescriptions": [
            localize(2117, null),
            localize(2118, null),
            localize(2119, null),
            localize(2120, null)
          ],
          "markdownDescription": getTelemetryLevelSettingDescription(),
          "default": "all",
          "restricted": true,
          "scope": 1,
          "tags": ["usesOnlineServices", "telemetry"]
        }
      }
    });
    $Wn.as($Ht.Configuration).registerConfiguration({
      "id": $Hv,
      "order": 110,
      "type": "object",
      "title": localize(2121, null),
      "properties": {
        [$Kv]: {
          "type": "boolean",
          "markdownDescription": !product_default.privacyStatementUrl ? localize(2122, null, product_default.nameLong) : localize(2123, null, product_default.nameLong, product_default.privacyStatementUrl),
          "default": true,
          "restricted": true,
          "markdownDeprecationMessage": localize(2124, null, `\`#${$Iv}#\``),
          "scope": 1,
          "tags": ["usesOnlineServices", "telemetry"]
        }
      }
    });
  }
});

// out-build/vs/platform/telemetry/common/serverTelemetryService.js
var $JX, $KX, $LX;
var init_serverTelemetryService = __esm({
  "out-build/vs/platform/telemetry/common/serverTelemetryService.js"() {
    "use strict";
    init_configuration();
    init_instantiation();
    init_productService();
    init_telemetry();
    init_telemetryService();
    init_telemetryUtils();
    $JX = class $JX2 extends $tz {
      constructor(config, injectedTelemetryLevel, _configurationService, _productService) {
        super(config, _configurationService, _productService);
        this.o = injectedTelemetryLevel;
      }
      publicLog(eventName, data) {
        if (this.o < 3) {
          return;
        }
        return super.publicLog(eventName, data);
      }
      publicLog2(eventName, data) {
        return this.publicLog(eventName, data);
      }
      publicLogError(errorEventName, data) {
        if (this.o < 2) {
          return Promise.resolve(void 0);
        }
        return super.publicLogError(errorEventName, data);
      }
      publicLogError2(eventName, data) {
        return this.publicLogError(eventName, data);
      }
      async updateInjectedTelemetryLevel(telemetryLevel) {
        if (telemetryLevel === void 0) {
          this.o = 0;
          throw new Error("Telemetry level cannot be undefined. This will cause infinite looping!");
        }
        this.o = this.o ? Math.min(this.o, telemetryLevel) : telemetryLevel;
        if (this.o === 0) {
          this.dispose();
        }
      }
    };
    $JX = __decorate([
      __param(2, $kl),
      __param(3, $Vu)
    ], $JX);
    $KX = new class extends $cw {
      async updateInjectedTelemetryLevel() {
        return;
      }
      // No-op, telemetry is already disabled
    }();
    $LX = $Rk($zv);
  }
});

// out-build/vs/base/common/mime.js
function $1C(path7) {
  const ext = $sc(path7);
  return mapExtToMediaMimes[ext.toLowerCase()];
}
function $3C(mimeType, strict) {
  const match = _simplePattern.exec(mimeType);
  if (!match) {
    return strict ? void 0 : mimeType;
  }
  return `${match[1].toLowerCase()}/${match[2].toLowerCase()}${match[3] ?? ""}`;
}
var $YC, mapExtToMediaMimes, _simplePattern;
var init_mime = __esm({
  "out-build/vs/base/common/mime.js"() {
    "use strict";
    init_path();
    $YC = Object.freeze({
      text: "text/plain",
      binary: "application/octet-stream",
      unknown: "application/unknown",
      markdown: "text/markdown",
      latex: "text/latex",
      uriList: "text/uri-list"
    });
    mapExtToMediaMimes = {
      ".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",
      ".jpeg": "image/jpg",
      ".jpg": "image/jpg",
      ".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"
    };
    _simplePattern = /^(.+)\/(.+?)(;.+)?$/;
  }
});

// out-build/vs/platform/remote/common/remoteAuthorityResolver.js
var $bC, RemoteConnectionType, RemoteAuthorityResolverErrorCode;
var init_remoteAuthorityResolver = __esm({
  "out-build/vs/platform/remote/common/remoteAuthorityResolver.js"() {
    "use strict";
    init_errors();
    init_instantiation();
    $bC = $Qk("remoteAuthorityResolverService");
    (function(RemoteConnectionType2) {
      RemoteConnectionType2[RemoteConnectionType2["WebSocket"] = 0] = "WebSocket";
      RemoteConnectionType2[RemoteConnectionType2["Managed"] = 1] = "Managed";
    })(RemoteConnectionType || (RemoteConnectionType = {}));
    (function(RemoteAuthorityResolverErrorCode2) {
      RemoteAuthorityResolverErrorCode2["Unknown"] = "Unknown";
      RemoteAuthorityResolverErrorCode2["NotAvailable"] = "NotAvailable";
      RemoteAuthorityResolverErrorCode2["TemporarilyNotAvailable"] = "TemporarilyNotAvailable";
      RemoteAuthorityResolverErrorCode2["NoResolverFound"] = "NoResolverFound";
      RemoteAuthorityResolverErrorCode2["InvalidAuthority"] = "InvalidAuthority";
    })(RemoteAuthorityResolverErrorCode || (RemoteAuthorityResolverErrorCode = {}));
  }
});

// out-build/vs/workbench/services/notebook/common/notebookDocumentService.js
function $9L(cell) {
  if (cell.scheme !== Schemas.vscodeNotebookCell) {
    return void 0;
  }
  const idx = cell.fragment.indexOf("s");
  if (idx < 0) {
    return void 0;
  }
  const handle = parseInt(cell.fragment.substring(0, idx).replace(_padRegexp, ""), _radix);
  const _scheme = $Vi(cell.fragment.substring(idx + 1)).toString();
  if (isNaN(handle)) {
    return void 0;
  }
  return {
    handle,
    notebook: cell.with({ scheme: _scheme, fragment: null })
  };
}
function $0L(notebook, handle) {
  const s = handle.toString(_radix);
  const p = s.length < _lengths.length ? _lengths[s.length - 1] : "z";
  const fragment = `${p}${s}s${$Wi($Ci.fromString(notebook.scheme), true, true)}`;
  return notebook.with({ scheme: Schemas.vscodeNotebookCell, fragment });
}
function $$L(metadata) {
  if (metadata.scheme !== Schemas.vscodeNotebookMetadata) {
    return void 0;
  }
  const _scheme = $Vi(metadata.fragment).toString();
  return metadata.with({ scheme: _scheme, fragment: null });
}
function $_L(notebook) {
  const fragment = `${$Wi($Ci.fromString(notebook.scheme), true, true)}`;
  return notebook.with({ scheme: Schemas.vscodeNotebookMetadata, fragment });
}
var $8L, _lengths, _padRegexp, _radix, $aM;
var init_notebookDocumentService = __esm({
  "out-build/vs/workbench/services/notebook/common/notebookDocumentService.js"() {
    "use strict";
    init_buffer();
    init_map();
    init_network();
    init_extensions2();
    init_instantiation();
    $8L = $Qk("notebookDocumentService");
    _lengths = ["W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f"];
    _padRegexp = new RegExp(`^[${_lengths.join("")}]+`);
    _radix = 7;
    $aM = class {
      constructor() {
        this.a = new $Ec();
      }
      getNotebook(uri) {
        if (uri.scheme === Schemas.vscodeNotebookCell) {
          const cellUri = $9L(uri);
          if (cellUri) {
            const document2 = this.a.get(cellUri.notebook);
            if (document2) {
              return document2;
            }
          }
        }
        return this.a.get(uri);
      }
      addNotebookDocument(document2) {
        this.a.set(document2.uri, document2);
      }
      removeNotebookDocument(document2) {
        this.a.delete(document2.uri);
      }
    };
    $SC(
      $8L,
      $aM,
      1
      /* InstantiationType.Delayed */
    );
  }
});

// out-build/vs/workbench/contrib/notebook/common/notebookCommon.js
function $tM(mimeType) {
  return ["application/vnd.code.notebook.stdout", "application/vnd.code.notebook.stderr"].includes(mimeType);
}
var CellKind, $hM, $iM, NotebookRunState, NotebookCellExecutionState, NotebookExecutionState, NotebookRendererMatch, RendererMessagingSpec, NotebookCellsChangeType, SelectionStateType, CellEditType, NotebookMetadataUri, CellUri, $nM, $oM, NotebookEditorPriority, NotebookFindScopeType, CellStatusbarAlignment, $sM, textDecoder2, $vM, MOVE_CURSOR_1_LINE_COMMAND_BYTES, BACKSPACE_CHARACTER, CARRIAGE_RETURN_CHARACTER;
var init_notebookCommon = __esm({
  "out-build/vs/workbench/contrib/notebook/common/notebookCommon.js"() {
    "use strict";
    init_buffer();
    init_glob();
    init_iterator();
    init_mime();
    init_network();
    init_path();
    init_platform();
    init_contextkey();
    init_notebookDocumentService();
    (function(CellKind2) {
      CellKind2[CellKind2["Markup"] = 1] = "Markup";
      CellKind2[CellKind2["Code"] = 2] = "Code";
    })(CellKind || (CellKind = {}));
    $hM = [
      "application/json",
      "application/javascript",
      "text/html",
      "image/svg+xml",
      $YC.latex,
      $YC.markdown,
      "image/png",
      "image/jpeg",
      $YC.text
    ];
    $iM = [
      $YC.latex,
      $YC.markdown,
      "application/json",
      "text/html",
      "image/svg+xml",
      "image/png",
      "image/jpeg",
      $YC.text
    ];
    (function(NotebookRunState2) {
      NotebookRunState2[NotebookRunState2["Running"] = 1] = "Running";
      NotebookRunState2[NotebookRunState2["Idle"] = 2] = "Idle";
    })(NotebookRunState || (NotebookRunState = {}));
    (function(NotebookCellExecutionState4) {
      NotebookCellExecutionState4[NotebookCellExecutionState4["Unconfirmed"] = 1] = "Unconfirmed";
      NotebookCellExecutionState4[NotebookCellExecutionState4["Pending"] = 2] = "Pending";
      NotebookCellExecutionState4[NotebookCellExecutionState4["Executing"] = 3] = "Executing";
    })(NotebookCellExecutionState || (NotebookCellExecutionState = {}));
    (function(NotebookExecutionState2) {
      NotebookExecutionState2[NotebookExecutionState2["Unconfirmed"] = 1] = "Unconfirmed";
      NotebookExecutionState2[NotebookExecutionState2["Pending"] = 2] = "Pending";
      NotebookExecutionState2[NotebookExecutionState2["Executing"] = 3] = "Executing";
    })(NotebookExecutionState || (NotebookExecutionState = {}));
    (function(NotebookRendererMatch2) {
      NotebookRendererMatch2[NotebookRendererMatch2["WithHardKernelDependency"] = 0] = "WithHardKernelDependency";
      NotebookRendererMatch2[NotebookRendererMatch2["WithOptionalKernelDependency"] = 1] = "WithOptionalKernelDependency";
      NotebookRendererMatch2[NotebookRendererMatch2["Pure"] = 2] = "Pure";
      NotebookRendererMatch2[NotebookRendererMatch2["Never"] = 3] = "Never";
    })(NotebookRendererMatch || (NotebookRendererMatch = {}));
    (function(RendererMessagingSpec2) {
      RendererMessagingSpec2["Always"] = "always";
      RendererMessagingSpec2["Never"] = "never";
      RendererMessagingSpec2["Optional"] = "optional";
    })(RendererMessagingSpec || (RendererMessagingSpec = {}));
    (function(NotebookCellsChangeType2) {
      NotebookCellsChangeType2[NotebookCellsChangeType2["ModelChange"] = 1] = "ModelChange";
      NotebookCellsChangeType2[NotebookCellsChangeType2["Move"] = 2] = "Move";
      NotebookCellsChangeType2[NotebookCellsChangeType2["ChangeCellLanguage"] = 5] = "ChangeCellLanguage";
      NotebookCellsChangeType2[NotebookCellsChangeType2["Initialize"] = 6] = "Initialize";
      NotebookCellsChangeType2[NotebookCellsChangeType2["ChangeCellMetadata"] = 7] = "ChangeCellMetadata";
      NotebookCellsChangeType2[NotebookCellsChangeType2["Output"] = 8] = "Output";
      NotebookCellsChangeType2[NotebookCellsChangeType2["OutputItem"] = 9] = "OutputItem";
      NotebookCellsChangeType2[NotebookCellsChangeType2["ChangeCellContent"] = 10] = "ChangeCellContent";
      NotebookCellsChangeType2[NotebookCellsChangeType2["ChangeDocumentMetadata"] = 11] = "ChangeDocumentMetadata";
      NotebookCellsChangeType2[NotebookCellsChangeType2["ChangeCellInternalMetadata"] = 12] = "ChangeCellInternalMetadata";
      NotebookCellsChangeType2[NotebookCellsChangeType2["ChangeCellMime"] = 13] = "ChangeCellMime";
      NotebookCellsChangeType2[NotebookCellsChangeType2["Unknown"] = 100] = "Unknown";
    })(NotebookCellsChangeType || (NotebookCellsChangeType = {}));
    (function(SelectionStateType2) {
      SelectionStateType2[SelectionStateType2["Handle"] = 0] = "Handle";
      SelectionStateType2[SelectionStateType2["Index"] = 1] = "Index";
    })(SelectionStateType || (SelectionStateType = {}));
    (function(CellEditType2) {
      CellEditType2[CellEditType2["Replace"] = 1] = "Replace";
      CellEditType2[CellEditType2["Output"] = 2] = "Output";
      CellEditType2[CellEditType2["Metadata"] = 3] = "Metadata";
      CellEditType2[CellEditType2["CellLanguage"] = 4] = "CellLanguage";
      CellEditType2[CellEditType2["DocumentMetadata"] = 5] = "DocumentMetadata";
      CellEditType2[CellEditType2["Move"] = 6] = "Move";
      CellEditType2[CellEditType2["OutputItems"] = 7] = "OutputItems";
      CellEditType2[CellEditType2["PartialMetadata"] = 8] = "PartialMetadata";
      CellEditType2[CellEditType2["PartialInternalMetadata"] = 9] = "PartialInternalMetadata";
    })(CellEditType || (CellEditType = {}));
    (function(NotebookMetadataUri2) {
      NotebookMetadataUri2.scheme = Schemas.vscodeNotebookMetadata;
      function generate(notebook) {
        return $_L(notebook);
      }
      NotebookMetadataUri2.generate = generate;
      function parse6(metadata) {
        return $$L(metadata);
      }
      NotebookMetadataUri2.parse = parse6;
    })(NotebookMetadataUri || (NotebookMetadataUri = {}));
    (function(CellUri2) {
      CellUri2.scheme = Schemas.vscodeNotebookCell;
      function generate(notebook, handle) {
        return $0L(notebook, handle);
      }
      CellUri2.generate = generate;
      function parse6(cell) {
        return $9L(cell);
      }
      CellUri2.parse = parse6;
      function generateCellOutputUri(notebook, outputId) {
        return notebook.with({
          scheme: Schemas.vscodeNotebookCellOutput,
          fragment: `op${outputId ?? ""},${notebook.scheme !== Schemas.file ? notebook.scheme : ""}`
        });
      }
      CellUri2.generateCellOutputUri = generateCellOutputUri;
      function parseCellOutputUri(uri) {
        if (uri.scheme !== Schemas.vscodeNotebookCellOutput) {
          return;
        }
        const match = /^op([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})?\,(.*)$/i.exec(uri.fragment);
        if (!match) {
          return void 0;
        }
        const outputId = match[1] && match[1] !== "" ? match[1] : void 0;
        const scheme = match[2];
        return {
          outputId,
          notebook: uri.with({
            scheme: scheme || Schemas.file,
            fragment: null
          })
        };
      }
      CellUri2.parseCellOutputUri = parseCellOutputUri;
      function generateCellPropertyUri(notebook, handle, scheme) {
        return CellUri2.generate(notebook, handle).with({ scheme });
      }
      CellUri2.generateCellPropertyUri = generateCellPropertyUri;
      function parseCellPropertyUri(uri, propertyScheme) {
        if (uri.scheme !== propertyScheme) {
          return void 0;
        }
        return CellUri2.parse(uri.with({ scheme: CellUri2.scheme }));
      }
      CellUri2.parseCellPropertyUri = parseCellPropertyUri;
    })(CellUri || (CellUri = {}));
    $nM = new $nn("notebookEditorCursorAtBoundary", "none");
    $oM = new $nn("notebookEditorCursorAtLineBoundary", "none");
    (function(NotebookEditorPriority2) {
      NotebookEditorPriority2["default"] = "default";
      NotebookEditorPriority2["option"] = "option";
    })(NotebookEditorPriority || (NotebookEditorPriority = {}));
    (function(NotebookFindScopeType2) {
      NotebookFindScopeType2["Cells"] = "cells";
      NotebookFindScopeType2["Text"] = "text";
      NotebookFindScopeType2["None"] = "none";
    })(NotebookFindScopeType || (NotebookFindScopeType = {}));
    (function(CellStatusbarAlignment2) {
      CellStatusbarAlignment2[CellStatusbarAlignment2["Left"] = 1] = "Left";
      CellStatusbarAlignment2[CellStatusbarAlignment2["Right"] = 2] = "Right";
    })(CellStatusbarAlignment || (CellStatusbarAlignment = {}));
    $sM = class _$sM {
      static {
        this.d = "notebook/";
      }
      static create(notebookType, viewType) {
        return `${_$sM.d}${notebookType}/${viewType ?? notebookType}`;
      }
      static parse(candidate) {
        if (candidate.startsWith(_$sM.d)) {
          const split = candidate.substring(_$sM.d.length).split("/");
          if (split.length === 2) {
            return { notebookType: split[0], viewType: split[1] };
          }
        }
        return void 0;
      }
    };
    textDecoder2 = new TextDecoder();
    $vM = `${String.fromCharCode(27)}[A`;
    MOVE_CURSOR_1_LINE_COMMAND_BYTES = $vM.split("").map((c) => c.charCodeAt(0));
    BACKSPACE_CHARACTER = "\b".charCodeAt(0);
    CARRIAGE_RETURN_CHARACTER = "\r".charCodeAt(0);
  }
});

// out-build/vs/workbench/api/common/extHostTypes.js
function es5ClassCompat(target) {
  const interceptFunctions = {
    apply: function(...args) {
      if (args.length === 0) {
        return Reflect.construct(target, []);
      } else {
        const argsList = args.length === 1 ? [] : args[1];
        return Reflect.construct(target, argsList, args[0].constructor);
      }
    },
    call: function(...args) {
      if (args.length === 0) {
        return Reflect.construct(target, []);
      } else {
        const [thisArg, ...restArgs] = args;
        return Reflect.construct(target, restArgs, thisArg.constructor);
      }
    }
  };
  return Object.assign(target, interceptFunctions);
}
function $DT(range) {
  return range.isEmpty ? `[${range.start.line}:${range.start.character})` : `[${range.start.line}:${range.start.character} -> ${range.end.line}:${range.end.character})`;
}
function $ET(selection) {
  let rangeStr = $DT(selection);
  if (!selection.isEmpty) {
    if (selection.active.isEqual(selection.start)) {
      rangeStr = `|${rangeStr}`;
    } else {
      rangeStr = `${rangeStr}|`;
    }
  }
  return rangeStr;
}
function computeTaskExecutionId(values) {
  let id2 = "";
  for (let i = 0; i < values.length; i++) {
    id2 += values[i].replace(/,/g, ",,") + ",";
  }
  return id2;
}
function $lV(cc) {
  if (!cc) {
    return;
  }
  if (cc.covered > cc.total) {
    throw new Error(`The total number of covered items (${cc.covered}) cannot be greater than the total (${cc.total})`);
  }
  if (cc.total < 0) {
    throw new Error(`The number of covered items (${cc.total}) cannot be negative`);
  }
}
var $zT_1, $AT_1, $BT_1, $CT_1, $IT_1, $JT_1, $MT_1, $NT_1, $UT_1, $VT_1, $XT_1, $4T_1, $mU_1, $qU_1, $rU_1, $UU_1, $hV_1, TerminalOutputAnchor, TerminalQuickFixType, $zT, $AT, $BT, $CT, EndOfLine, EnvironmentVariableMutatorType2, $IT, $JT, $KT, FileEditType, $LT, $MT, DiagnosticTag, DiagnosticSeverity, $NT, $OT, $PT, $QT, $RT, HoverVerbosityAction, DocumentHighlightKind, $ST, $TT, SymbolKind, SymbolTag, $UT, $VT, CodeActionTriggerKind, $WT, $XT, $YT, $ZT, $1T, $2T, LanguageStatusSeverity, $3T, $4T, $5T, $6T, $7T, SignatureHelpTriggerKind, InlayHintKind, $8T, $9T, CompletionTriggerKind, CompletionItemKind, CompletionItemTag, $0T, $$T, $_T, $aU, PartialAcceptTriggerKind, ViewColumn, StatusBarAlignment, TextEditorLineNumbersStyle, TextDocumentSaveReason, TextEditorRevealType, TextEditorSelectionChangeKind, TextEditorChangeKind, TextDocumentChangeReason, DecorationRangeBehavior, SyntaxTokenType, $cU, $dU, $eU, $fU, ColorFormat, SourceControlInputBoxValidationType, TerminalExitReason2, TerminalShellExecutionCommandLineConfidence, TerminalLocation2, TerminalCompletionItemKind, TaskRevealKind, TaskPanelKind, $mU, $nU, $oU, ShellQuoting, TaskScope, $pU, $qU, ProgressLocation, ViewBadge, $rU, TreeItemCollapsibleState, TreeItemCheckboxState, $sU, $tU, $uU, $vU, $wU, $xU, DocumentPasteTriggerKind, $yU, $AU, $BU, ConfigurationTarget2, $CU, breakpointIds, $EU, $FU, $GU, $HU, $IU, $JU, $KU, $LU, $OU, InlineCompletionTriggerKind, $PU, $QU, $RU, $SU, NewSymbolNameTag, NewSymbolNameTriggerKind, FileChangeType2, $UU, $VU, FoldingRangeKind, CommentThreadCollapsibleState, CommentMode, CommentState, CommentThreadState, CommentThreadApplicability, CommentThreadFocus, DebugConsoleMode, QuickInputButtonLocation, $3U, QuickPickItemKind, InputBoxValidationSeverity, ExtensionKind, $5U, ColorThemeKind, $6U, $7U, $8U, $9U, $0U, NotebookCellKind, NotebookCellExecutionState2, NotebookCellStatusBarAlignment, NotebookEditorRevealType, NotebookControllerAffinity, NotebookControllerAffinity2, $aV, NotebookVariablesRequestKind, $cV, ExtensionMode, ExtensionRuntime, StandardTokenType, TestResultState, TestRunProfileKind, $fV, $gV, $hV, $iV, $kV, $mV, $nV, $oV, $pV, ExternalUriOpenerPriority, WorkspaceTrustState, PortAutoForwardAction, $qV, InteractiveSessionVoteDirection, ChatCopyKind, ChatVariableLevel, ChatEditingSessionActionOutcome, InteractiveEditorResponseFeedbackKind, ChatResultFeedbackKind, $DV, $EV, $FV, $GV, $HV, $IV, $JV, $LV, $MV, $NV, $OV, $PV, $QV, $RV, ChatLocation, ChatResponseReferencePartStatusKind, $WV, LanguageModelChatMessageRole, $XV, $YV, $ZV, $1V, $2V, $7V, LanguageModelChatToolMode, RelatedInformationType, SpeechToTextStatus, TextToSpeechStatus, KeywordRecognitionStatus, InlineEditTriggerKind;
var init_extHostTypes = __esm({
  "out-build/vs/workbench/api/common/extHostTypes.js"() {
    "use strict";
    init_arrays();
    init_errors();
    init_htmlContent();
    init_map();
    init_mime();
    init_strings();
    init_types();
    init_uri();
    init_uuid();
    init_extensions();
    init_files();
    init_remoteAuthorityResolver();
    init_notebookCommon();
    (function(TerminalOutputAnchor2) {
      TerminalOutputAnchor2[TerminalOutputAnchor2["Top"] = 0] = "Top";
      TerminalOutputAnchor2[TerminalOutputAnchor2["Bottom"] = 1] = "Bottom";
    })(TerminalOutputAnchor || (TerminalOutputAnchor = {}));
    (function(TerminalQuickFixType2) {
      TerminalQuickFixType2[TerminalQuickFixType2["TerminalCommand"] = 0] = "TerminalCommand";
      TerminalQuickFixType2[TerminalQuickFixType2["Opener"] = 1] = "Opener";
      TerminalQuickFixType2[TerminalQuickFixType2["Command"] = 3] = "Command";
    })(TerminalQuickFixType || (TerminalQuickFixType = {}));
    $zT = $zT_1 = class $zT2 {
      static from(...inDisposables) {
        let disposables = inDisposables;
        return new $zT_1(function() {
          if (disposables) {
            for (const disposable of disposables) {
              if (disposable && typeof disposable.dispose === "function") {
                disposable.dispose();
              }
            }
            disposables = void 0;
          }
        });
      }
      #callOnDispose;
      constructor(callOnDispose) {
        this.#callOnDispose = callOnDispose;
      }
      dispose() {
        if (typeof this.#callOnDispose === "function") {
          this.#callOnDispose();
          this.#callOnDispose = void 0;
        }
      }
    };
    $zT = $zT_1 = __decorate([
      es5ClassCompat
    ], $zT);
    $AT = $AT_1 = class $AT2 {
      static Min(...positions) {
        if (positions.length === 0) {
          throw new TypeError();
        }
        let result = positions[0];
        for (let i = 1; i < positions.length; i++) {
          const p = positions[i];
          if (p.isBefore(result)) {
            result = p;
          }
        }
        return result;
      }
      static Max(...positions) {
        if (positions.length === 0) {
          throw new TypeError();
        }
        let result = positions[0];
        for (let i = 1; i < positions.length; i++) {
          const p = positions[i];
          if (p.isAfter(result)) {
            result = p;
          }
        }
        return result;
      }
      static isPosition(other) {
        if (!other) {
          return false;
        }
        if (other instanceof $AT_1) {
          return true;
        }
        const { line, character } = other;
        if (typeof line === "number" && typeof character === "number") {
          return true;
        }
        return false;
      }
      static of(obj) {
        if (obj instanceof $AT_1) {
          return obj;
        } else if (this.isPosition(obj)) {
          return new $AT_1(obj.line, obj.character);
        }
        throw new Error("Invalid argument, is NOT a position-like object");
      }
      get line() {
        return this.c;
      }
      get character() {
        return this.e;
      }
      constructor(line, character) {
        if (line < 0) {
          throw $nb("line must be non-negative");
        }
        if (character < 0) {
          throw $nb("character must be non-negative");
        }
        this.c = line;
        this.e = character;
      }
      isBefore(other) {
        if (this.c < other.c) {
          return true;
        }
        if (other.c < this.c) {
          return false;
        }
        return this.e < other.e;
      }
      isBeforeOrEqual(other) {
        if (this.c < other.c) {
          return true;
        }
        if (other.c < this.c) {
          return false;
        }
        return this.e <= other.e;
      }
      isAfter(other) {
        return !this.isBeforeOrEqual(other);
      }
      isAfterOrEqual(other) {
        return !this.isBefore(other);
      }
      isEqual(other) {
        return this.c === other.c && this.e === other.e;
      }
      compareTo(other) {
        if (this.c < other.c) {
          return -1;
        } else if (this.c > other.line) {
          return 1;
        } else {
          if (this.e < other.e) {
            return -1;
          } else if (this.e > other.e) {
            return 1;
          } else {
            return 0;
          }
        }
      }
      translate(lineDeltaOrChange, characterDelta = 0) {
        if (lineDeltaOrChange === null || characterDelta === null) {
          throw $nb();
        }
        let lineDelta;
        if (typeof lineDeltaOrChange === "undefined") {
          lineDelta = 0;
        } else if (typeof lineDeltaOrChange === "number") {
          lineDelta = lineDeltaOrChange;
        } else {
          lineDelta = typeof lineDeltaOrChange.lineDelta === "number" ? lineDeltaOrChange.lineDelta : 0;
          characterDelta = typeof lineDeltaOrChange.characterDelta === "number" ? lineDeltaOrChange.characterDelta : 0;
        }
        if (lineDelta === 0 && characterDelta === 0) {
          return this;
        }
        return new $AT_1(this.line + lineDelta, this.character + characterDelta);
      }
      with(lineOrChange, character = this.character) {
        if (lineOrChange === null || character === null) {
          throw $nb();
        }
        let line;
        if (typeof lineOrChange === "undefined") {
          line = this.line;
        } else if (typeof lineOrChange === "number") {
          line = lineOrChange;
        } else {
          line = typeof lineOrChange.line === "number" ? lineOrChange.line : this.line;
          character = typeof lineOrChange.character === "number" ? lineOrChange.character : this.character;
        }
        if (line === this.line && character === this.character) {
          return this;
        }
        return new $AT_1(line, character);
      }
      toJSON() {
        return { line: this.line, character: this.character };
      }
      [Symbol.for("debug.description")]() {
        return `(${this.line}:${this.character})`;
      }
    };
    $AT = $AT_1 = __decorate([
      es5ClassCompat
    ], $AT);
    $BT = $BT_1 = class $BT2 {
      static isRange(thing) {
        if (thing instanceof $BT_1) {
          return true;
        }
        if (!thing) {
          return false;
        }
        return $AT.isPosition(thing.start) && $AT.isPosition(thing.end);
      }
      static of(obj) {
        if (obj instanceof $BT_1) {
          return obj;
        }
        if (this.isRange(obj)) {
          return new $BT_1(obj.start, obj.end);
        }
        throw new Error("Invalid argument, is NOT a range-like object");
      }
      get start() {
        return this.c;
      }
      get end() {
        return this.e;
      }
      constructor(startLineOrStart, startColumnOrEnd, endLine, endColumn) {
        let start;
        let end;
        if (typeof startLineOrStart === "number" && typeof startColumnOrEnd === "number" && typeof endLine === "number" && typeof endColumn === "number") {
          start = new $AT(startLineOrStart, startColumnOrEnd);
          end = new $AT(endLine, endColumn);
        } else if ($AT.isPosition(startLineOrStart) && $AT.isPosition(startColumnOrEnd)) {
          start = $AT.of(startLineOrStart);
          end = $AT.of(startColumnOrEnd);
        }
        if (!start || !end) {
          throw new Error("Invalid arguments");
        }
        if (start.isBefore(end)) {
          this.c = start;
          this.e = end;
        } else {
          this.c = end;
          this.e = start;
        }
      }
      contains(positionOrRange) {
        if ($BT_1.isRange(positionOrRange)) {
          return this.contains(positionOrRange.start) && this.contains(positionOrRange.end);
        } else if ($AT.isPosition(positionOrRange)) {
          if ($AT.of(positionOrRange).isBefore(this.c)) {
            return false;
          }
          if (this.e.isBefore(positionOrRange)) {
            return false;
          }
          return true;
        }
        return false;
      }
      isEqual(other) {
        return this.c.isEqual(other.c) && this.e.isEqual(other.e);
      }
      intersection(other) {
        const start = $AT.Max(other.start, this.c);
        const end = $AT.Min(other.end, this.e);
        if (start.isAfter(end)) {
          return void 0;
        }
        return new $BT_1(start, end);
      }
      union(other) {
        if (this.contains(other)) {
          return this;
        } else if (other.contains(this)) {
          return other;
        }
        const start = $AT.Min(other.start, this.c);
        const end = $AT.Max(other.end, this.end);
        return new $BT_1(start, end);
      }
      get isEmpty() {
        return this.c.isEqual(this.e);
      }
      get isSingleLine() {
        return this.c.line === this.e.line;
      }
      with(startOrChange, end = this.end) {
        if (startOrChange === null || end === null) {
          throw $nb();
        }
        let start;
        if (!startOrChange) {
          start = this.start;
        } else if ($AT.isPosition(startOrChange)) {
          start = startOrChange;
        } else {
          start = startOrChange.start || this.start;
          end = startOrChange.end || this.end;
        }
        if (start.isEqual(this.c) && end.isEqual(this.end)) {
          return this;
        }
        return new $BT_1(start, end);
      }
      toJSON() {
        return [this.start, this.end];
      }
      [Symbol.for("debug.description")]() {
        return $DT(this);
      }
    };
    $BT = $BT_1 = __decorate([
      es5ClassCompat
    ], $BT);
    $CT = $CT_1 = class $CT2 extends $BT {
      static isSelection(thing) {
        if (thing instanceof $CT_1) {
          return true;
        }
        if (!thing) {
          return false;
        }
        return $BT.isRange(thing) && $AT.isPosition(thing.anchor) && $AT.isPosition(thing.active) && typeof thing.isReversed === "boolean";
      }
      get anchor() {
        return this.f;
      }
      get active() {
        return this.g;
      }
      constructor(anchorLineOrAnchor, anchorColumnOrActive, activeLine, activeColumn) {
        let anchor;
        let active;
        if (typeof anchorLineOrAnchor === "number" && typeof anchorColumnOrActive === "number" && typeof activeLine === "number" && typeof activeColumn === "number") {
          anchor = new $AT(anchorLineOrAnchor, anchorColumnOrActive);
          active = new $AT(activeLine, activeColumn);
        } else if ($AT.isPosition(anchorLineOrAnchor) && $AT.isPosition(anchorColumnOrActive)) {
          anchor = $AT.of(anchorLineOrAnchor);
          active = $AT.of(anchorColumnOrActive);
        }
        if (!anchor || !active) {
          throw new Error("Invalid arguments");
        }
        super(anchor, active);
        this.f = anchor;
        this.g = active;
      }
      get isReversed() {
        return this.f === this.e;
      }
      toJSON() {
        return {
          start: this.start,
          end: this.end,
          active: this.active,
          anchor: this.anchor
        };
      }
      [Symbol.for("debug.description")]() {
        return $ET(this);
      }
    };
    $CT = $CT_1 = __decorate([
      es5ClassCompat
    ], $CT);
    (function(EndOfLine3) {
      EndOfLine3[EndOfLine3["LF"] = 1] = "LF";
      EndOfLine3[EndOfLine3["CRLF"] = 2] = "CRLF";
    })(EndOfLine || (EndOfLine = {}));
    (function(EnvironmentVariableMutatorType3) {
      EnvironmentVariableMutatorType3[EnvironmentVariableMutatorType3["Replace"] = 1] = "Replace";
      EnvironmentVariableMutatorType3[EnvironmentVariableMutatorType3["Append"] = 2] = "Append";
      EnvironmentVariableMutatorType3[EnvironmentVariableMutatorType3["Prepend"] = 3] = "Prepend";
    })(EnvironmentVariableMutatorType2 || (EnvironmentVariableMutatorType2 = {}));
    $IT = $IT_1 = class $IT2 {
      static isTextEdit(thing) {
        if (thing instanceof $IT_1) {
          return true;
        }
        if (!thing) {
          return false;
        }
        return $BT.isRange(thing) && typeof thing.newText === "string";
      }
      static replace(range, newText) {
        return new $IT_1(range, newText);
      }
      static insert(position, newText) {
        return $IT_1.replace(new $BT(position, position), newText);
      }
      static delete(range) {
        return $IT_1.replace(range, "");
      }
      static setEndOfLine(eol) {
        const ret = new $IT_1(new $BT(new $AT(0, 0), new $AT(0, 0)), "");
        ret.newEol = eol;
        return ret;
      }
      get range() {
        return this.c;
      }
      set range(value) {
        if (value && !$BT.isRange(value)) {
          throw $nb("range");
        }
        this.c = value;
      }
      get newText() {
        return this.e || "";
      }
      set newText(value) {
        if (value && typeof value !== "string") {
          throw $nb("newText");
        }
        this.e = value;
      }
      get newEol() {
        return this.f;
      }
      set newEol(value) {
        if (value && typeof value !== "number") {
          throw $nb("newEol");
        }
        this.f = value;
      }
      constructor(range, newText) {
        this.c = range;
        this.e = newText;
      }
      toJSON() {
        return {
          range: this.range,
          newText: this.newText,
          newEol: this.f
        };
      }
    };
    $IT = $IT_1 = __decorate([
      es5ClassCompat
    ], $IT);
    $JT = $JT_1 = class $JT2 {
      static isNotebookCellEdit(thing) {
        if (thing instanceof $JT_1) {
          return true;
        }
        if (!thing) {
          return false;
        }
        return $6U.isNotebookRange(thing) && Array.isArray(thing.newCells);
      }
      static replaceCells(range, newCells) {
        return new $JT_1(range, newCells);
      }
      static insertCells(index, newCells) {
        return new $JT_1(new $6U(index, index), newCells);
      }
      static deleteCells(range) {
        return new $JT_1(range, []);
      }
      static updateCellMetadata(index, newMetadata) {
        const edit2 = new $JT_1(new $6U(index, index), []);
        edit2.newCellMetadata = newMetadata;
        return edit2;
      }
      static updateNotebookMetadata(newMetadata) {
        const edit2 = new $JT_1(new $6U(0, 0), []);
        edit2.newNotebookMetadata = newMetadata;
        return edit2;
      }
      constructor(range, newCells) {
        this.range = range;
        this.newCells = newCells;
      }
    };
    $JT = $JT_1 = __decorate([
      es5ClassCompat
    ], $JT);
    $KT = class _$KT {
      static isSnippetTextEdit(thing) {
        if (thing instanceof _$KT) {
          return true;
        }
        if (!thing) {
          return false;
        }
        return $BT.isRange(thing.range) && $MT.isSnippetString(thing.snippet);
      }
      static replace(range, snippet) {
        return new _$KT(range, snippet);
      }
      static insert(position, snippet) {
        return _$KT.replace(new $BT(position, position), snippet);
      }
      constructor(range, snippet) {
        this.range = range;
        this.snippet = snippet;
      }
    };
    (function(FileEditType2) {
      FileEditType2[FileEditType2["File"] = 1] = "File";
      FileEditType2[FileEditType2["Text"] = 2] = "Text";
      FileEditType2[FileEditType2["Cell"] = 3] = "Cell";
      FileEditType2[FileEditType2["CellReplace"] = 5] = "CellReplace";
      FileEditType2[FileEditType2["Snippet"] = 6] = "Snippet";
    })(FileEditType || (FileEditType = {}));
    $LT = class $LT2 {
      constructor() {
        this.c = [];
      }
      _allEntries() {
        return this.c;
      }
      // --- file
      renameFile(from, to, options2, metadata) {
        this.c.push({ _type: 1, from, to, options: options2, metadata });
      }
      createFile(uri, options2, metadata) {
        this.c.push({ _type: 1, from: void 0, to: uri, options: options2, metadata });
      }
      deleteFile(uri, options2, metadata) {
        this.c.push({ _type: 1, from: uri, to: void 0, options: options2, metadata });
      }
      // --- notebook
      e(uri, value, metadata) {
        this.c.push({ _type: 3, metadata, uri, edit: { editType: 5, metadata: value } });
      }
      f(uri, startOrRange, cellData, metadata) {
        const start = startOrRange.start;
        const end = startOrRange.end;
        if (start !== end || cellData.length > 0) {
          this.c.push({ _type: 5, uri, index: start, count: end - start, cells: cellData, metadata });
        }
      }
      g(uri, index, cellMetadata, metadata) {
        this.c.push({ _type: 3, metadata, uri, edit: { editType: 3, index, metadata: cellMetadata } });
      }
      // --- text
      replace(uri, range, newText, metadata) {
        this.c.push({ _type: 2, uri, edit: new $IT(range, newText), metadata });
      }
      insert(resource, position, newText, metadata) {
        this.replace(resource, new $BT(position, position), newText, metadata);
      }
      delete(resource, range, metadata) {
        this.replace(resource, range, "", metadata);
      }
      // --- text (Maplike)
      has(uri) {
        return this.c.some((edit2) => edit2._type === 2 && edit2.uri.toString() === uri.toString());
      }
      set(uri, edits) {
        if (!edits) {
          for (let i = 0; i < this.c.length; i++) {
            const element = this.c[i];
            switch (element._type) {
              case 2:
              case 6:
              case 3:
              case 5:
                if (element.uri.toString() === uri.toString()) {
                  this.c[i] = void 0;
                }
                break;
            }
          }
          $Nb(this.c);
        } else {
          for (const editOrTuple of edits) {
            if (!editOrTuple) {
              continue;
            }
            let edit2;
            let metadata;
            if (Array.isArray(editOrTuple)) {
              edit2 = editOrTuple[0];
              metadata = editOrTuple[1];
            } else {
              edit2 = editOrTuple;
            }
            if ($JT.isNotebookCellEdit(edit2)) {
              if (edit2.newCellMetadata) {
                this.g(uri, edit2.range.start, edit2.newCellMetadata, metadata);
              } else if (edit2.newNotebookMetadata) {
                this.e(uri, edit2.newNotebookMetadata, metadata);
              } else {
                this.f(uri, edit2.range, edit2.newCells, metadata);
              }
            } else if ($KT.isSnippetTextEdit(edit2)) {
              this.c.push({ _type: 6, uri, range: edit2.range, edit: edit2.snippet, metadata });
            } else {
              this.c.push({ _type: 2, uri, edit: edit2, metadata });
            }
          }
        }
      }
      get(uri) {
        const res = [];
        for (const candidate of this.c) {
          if (candidate._type === 2 && candidate.uri.toString() === uri.toString()) {
            res.push(candidate.edit);
          }
        }
        return res;
      }
      entries() {
        const textEdits = new $Ec();
        for (const candidate of this.c) {
          if (candidate._type === 2) {
            let textEdit = textEdits.get(candidate.uri);
            if (!textEdit) {
              textEdit = [candidate.uri, []];
              textEdits.set(candidate.uri, textEdit);
            }
            textEdit[1].push(candidate.edit);
          }
        }
        return [...textEdits.values()];
      }
      get size() {
        return this.entries().length;
      }
      toJSON() {
        return this.entries();
      }
    };
    $LT = __decorate([
      es5ClassCompat
    ], $LT);
    $MT = $MT_1 = class $MT2 {
      static isSnippetString(thing) {
        if (thing instanceof $MT_1) {
          return true;
        }
        if (!thing) {
          return false;
        }
        return typeof thing.value === "string";
      }
      static c(value) {
        return value.replace(/\$|}|\\/g, "\\$&");
      }
      constructor(value) {
        this.e = 1;
        this.value = value || "";
      }
      appendText(string) {
        this.value += $MT_1.c(string);
        return this;
      }
      appendTabstop(number = this.e++) {
        this.value += "$";
        this.value += number;
        return this;
      }
      appendPlaceholder(value, number = this.e++) {
        if (typeof value === "function") {
          const nested = new $MT_1();
          nested.e = this.e;
          value(nested);
          this.e = nested.e;
          value = nested.value;
        } else {
          value = $MT_1.c(value);
        }
        this.value += "${";
        this.value += number;
        this.value += ":";
        this.value += value;
        this.value += "}";
        return this;
      }
      appendChoice(values, number = this.e++) {
        const value = values.map((s) => s.replaceAll(/[|\\,]/g, "\\$&")).join(",");
        this.value += "${";
        this.value += number;
        this.value += "|";
        this.value += value;
        this.value += "|}";
        return this;
      }
      appendVariable(name, defaultValue) {
        if (typeof defaultValue === "function") {
          const nested = new $MT_1();
          nested.e = this.e;
          defaultValue(nested);
          this.e = nested.e;
          defaultValue = nested.value;
        } else if (typeof defaultValue === "string") {
          defaultValue = defaultValue.replace(/\$|}/g, "\\$&");
        }
        this.value += "${";
        this.value += name;
        if (defaultValue) {
          this.value += ":";
          this.value += defaultValue;
        }
        this.value += "}";
        return this;
      }
    };
    $MT = $MT_1 = __decorate([
      es5ClassCompat
    ], $MT);
    (function(DiagnosticTag3) {
      DiagnosticTag3[DiagnosticTag3["Unnecessary"] = 1] = "Unnecessary";
      DiagnosticTag3[DiagnosticTag3["Deprecated"] = 2] = "Deprecated";
    })(DiagnosticTag || (DiagnosticTag = {}));
    (function(DiagnosticSeverity3) {
      DiagnosticSeverity3[DiagnosticSeverity3["Hint"] = 3] = "Hint";
      DiagnosticSeverity3[DiagnosticSeverity3["Information"] = 2] = "Information";
      DiagnosticSeverity3[DiagnosticSeverity3["Warning"] = 1] = "Warning";
      DiagnosticSeverity3[DiagnosticSeverity3["Error"] = 0] = "Error";
    })(DiagnosticSeverity || (DiagnosticSeverity = {}));
    $NT = $NT_1 = class $NT2 {
      static isLocation(thing) {
        if (thing instanceof $NT_1) {
          return true;
        }
        if (!thing) {
          return false;
        }
        return $BT.isRange(thing.range) && URI.isUri(thing.uri);
      }
      constructor(uri, rangeOrPosition) {
        this.uri = uri;
        if (!rangeOrPosition) {
        } else if ($BT.isRange(rangeOrPosition)) {
          this.range = $BT.of(rangeOrPosition);
        } else if ($AT.isPosition(rangeOrPosition)) {
          this.range = new $BT(rangeOrPosition, rangeOrPosition);
        } else {
          throw new Error("Illegal argument");
        }
      }
      toJSON() {
        return {
          uri: this.uri,
          range: this.range
        };
      }
    };
    $NT = $NT_1 = __decorate([
      es5ClassCompat
    ], $NT);
    $OT = class $OT2 {
      static is(thing) {
        if (!thing) {
          return false;
        }
        return typeof thing.message === "string" && thing.location && $BT.isRange(thing.location.range) && URI.isUri(thing.location.uri);
      }
      constructor(location2, message) {
        this.location = location2;
        this.message = message;
      }
      static isEqual(a, b) {
        if (a === b) {
          return true;
        }
        if (!a || !b) {
          return false;
        }
        return a.message === b.message && a.location.range.isEqual(b.location.range) && a.location.uri.toString() === b.location.uri.toString();
      }
    };
    $OT = __decorate([
      es5ClassCompat
    ], $OT);
    $PT = class $PT2 {
      constructor(range, message, severity = DiagnosticSeverity.Error) {
        if (!$BT.isRange(range)) {
          throw new TypeError("range must be set");
        }
        if (!message) {
          throw new TypeError("message must be set");
        }
        this.range = range;
        this.message = message;
        this.severity = severity;
      }
      toJSON() {
        return {
          severity: DiagnosticSeverity[this.severity],
          message: this.message,
          range: this.range,
          source: this.source,
          code: this.code
        };
      }
      static isEqual(a, b) {
        if (a === b) {
          return true;
        }
        if (!a || !b) {
          return false;
        }
        return a.message === b.message && a.severity === b.severity && a.code === b.code && a.severity === b.severity && a.source === b.source && a.range.isEqual(b.range) && $zb(a.tags, b.tags) && $zb(a.relatedInformation, b.relatedInformation, $OT.isEqual);
      }
    };
    $PT = __decorate([
      es5ClassCompat
    ], $PT);
    $QT = class $QT2 {
      constructor(contents, range) {
        if (!contents) {
          throw new Error("Illegal argument, contents must be defined");
        }
        if (Array.isArray(contents)) {
          this.contents = contents;
        } else {
          this.contents = [contents];
        }
        this.range = range;
      }
    };
    $QT = __decorate([
      es5ClassCompat
    ], $QT);
    $RT = class $RT2 extends $QT {
      constructor(contents, range, canIncreaseVerbosity, canDecreaseVerbosity) {
        super(contents, range);
        this.canIncreaseVerbosity = canIncreaseVerbosity;
        this.canDecreaseVerbosity = canDecreaseVerbosity;
      }
    };
    $RT = __decorate([
      es5ClassCompat
    ], $RT);
    (function(HoverVerbosityAction3) {
      HoverVerbosityAction3[HoverVerbosityAction3["Increase"] = 0] = "Increase";
      HoverVerbosityAction3[HoverVerbosityAction3["Decrease"] = 1] = "Decrease";
    })(HoverVerbosityAction || (HoverVerbosityAction = {}));
    (function(DocumentHighlightKind3) {
      DocumentHighlightKind3[DocumentHighlightKind3["Text"] = 0] = "Text";
      DocumentHighlightKind3[DocumentHighlightKind3["Read"] = 1] = "Read";
      DocumentHighlightKind3[DocumentHighlightKind3["Write"] = 2] = "Write";
    })(DocumentHighlightKind || (DocumentHighlightKind = {}));
    $ST = class $ST2 {
      constructor(range, kind = DocumentHighlightKind.Text) {
        this.range = range;
        this.kind = kind;
      }
      toJSON() {
        return {
          range: this.range,
          kind: DocumentHighlightKind[this.kind]
        };
      }
    };
    $ST = __decorate([
      es5ClassCompat
    ], $ST);
    $TT = class $TT2 {
      constructor(uri, highlights) {
        this.uri = uri;
        this.highlights = highlights;
      }
      toJSON() {
        return {
          uri: this.uri,
          highlights: this.highlights.map((h) => h.toJSON())
        };
      }
    };
    $TT = __decorate([
      es5ClassCompat
    ], $TT);
    (function(SymbolKind4) {
      SymbolKind4[SymbolKind4["File"] = 0] = "File";
      SymbolKind4[SymbolKind4["Module"] = 1] = "Module";
      SymbolKind4[SymbolKind4["Namespace"] = 2] = "Namespace";
      SymbolKind4[SymbolKind4["Package"] = 3] = "Package";
      SymbolKind4[SymbolKind4["Class"] = 4] = "Class";
      SymbolKind4[SymbolKind4["Method"] = 5] = "Method";
      SymbolKind4[SymbolKind4["Property"] = 6] = "Property";
      SymbolKind4[SymbolKind4["Field"] = 7] = "Field";
      SymbolKind4[SymbolKind4["Constructor"] = 8] = "Constructor";
      SymbolKind4[SymbolKind4["Enum"] = 9] = "Enum";
      SymbolKind4[SymbolKind4["Interface"] = 10] = "Interface";
      SymbolKind4[SymbolKind4["Function"] = 11] = "Function";
      SymbolKind4[SymbolKind4["Variable"] = 12] = "Variable";
      SymbolKind4[SymbolKind4["Constant"] = 13] = "Constant";
      SymbolKind4[SymbolKind4["String"] = 14] = "String";
      SymbolKind4[SymbolKind4["Number"] = 15] = "Number";
      SymbolKind4[SymbolKind4["Boolean"] = 16] = "Boolean";
      SymbolKind4[SymbolKind4["Array"] = 17] = "Array";
      SymbolKind4[SymbolKind4["Object"] = 18] = "Object";
      SymbolKind4[SymbolKind4["Key"] = 19] = "Key";
      SymbolKind4[SymbolKind4["Null"] = 20] = "Null";
      SymbolKind4[SymbolKind4["EnumMember"] = 21] = "EnumMember";
      SymbolKind4[SymbolKind4["Struct"] = 22] = "Struct";
      SymbolKind4[SymbolKind4["Event"] = 23] = "Event";
      SymbolKind4[SymbolKind4["Operator"] = 24] = "Operator";
      SymbolKind4[SymbolKind4["TypeParameter"] = 25] = "TypeParameter";
    })(SymbolKind || (SymbolKind = {}));
    (function(SymbolTag4) {
      SymbolTag4[SymbolTag4["Deprecated"] = 1] = "Deprecated";
    })(SymbolTag || (SymbolTag = {}));
    $UT = $UT_1 = class $UT2 {
      static validate(candidate) {
        if (!candidate.name) {
          throw new Error("name must not be falsy");
        }
      }
      constructor(name, kind, rangeOrContainer, locationOrUri, containerName) {
        this.name = name;
        this.kind = kind;
        this.containerName = containerName;
        if (typeof rangeOrContainer === "string") {
          this.containerName = rangeOrContainer;
        }
        if (locationOrUri instanceof $NT) {
          this.location = locationOrUri;
        } else if (rangeOrContainer instanceof $BT) {
          this.location = new $NT(locationOrUri, rangeOrContainer);
        }
        $UT_1.validate(this);
      }
      toJSON() {
        return {
          name: this.name,
          kind: SymbolKind[this.kind],
          location: this.location,
          containerName: this.containerName
        };
      }
    };
    $UT = $UT_1 = __decorate([
      es5ClassCompat
    ], $UT);
    $VT = $VT_1 = class $VT2 {
      static validate(candidate) {
        if (!candidate.name) {
          throw new Error("name must not be falsy");
        }
        if (!candidate.range.contains(candidate.selectionRange)) {
          throw new Error("selectionRange must be contained in fullRange");
        }
        candidate.children?.forEach($VT_1.validate);
      }
      constructor(name, detail, kind, range, selectionRange) {
        this.name = name;
        this.detail = detail;
        this.kind = kind;
        this.range = range;
        this.selectionRange = selectionRange;
        this.children = [];
        $VT_1.validate(this);
      }
    };
    $VT = $VT_1 = __decorate([
      es5ClassCompat
    ], $VT);
    (function(CodeActionTriggerKind3) {
      CodeActionTriggerKind3[CodeActionTriggerKind3["Invoke"] = 1] = "Invoke";
      CodeActionTriggerKind3[CodeActionTriggerKind3["Automatic"] = 2] = "Automatic";
    })(CodeActionTriggerKind || (CodeActionTriggerKind = {}));
    $WT = class $WT2 {
      constructor(title, kind) {
        this.title = title;
        this.kind = kind;
      }
    };
    $WT = __decorate([
      es5ClassCompat
    ], $WT);
    $XT = class $XT2 {
      static {
        $XT_1 = this;
      }
      static {
        this.c = ".";
      }
      constructor(value) {
        this.value = value;
      }
      append(parts) {
        return new $XT_1(this.value ? this.value + $XT_1.c + parts : parts);
      }
      intersects(other) {
        return this.contains(other) || other.contains(this);
      }
      contains(other) {
        return this.value === other.value || other.value.startsWith(this.value + $XT_1.c);
      }
    };
    $XT = $XT_1 = __decorate([
      es5ClassCompat
    ], $XT);
    $XT.Empty = new $XT("");
    $XT.QuickFix = $XT.Empty.append("quickfix");
    $XT.Refactor = $XT.Empty.append("refactor");
    $XT.RefactorExtract = $XT.Refactor.append("extract");
    $XT.RefactorInline = $XT.Refactor.append("inline");
    $XT.RefactorMove = $XT.Refactor.append("move");
    $XT.RefactorRewrite = $XT.Refactor.append("rewrite");
    $XT.Source = $XT.Empty.append("source");
    $XT.SourceOrganizeImports = $XT.Source.append("organizeImports");
    $XT.SourceFixAll = $XT.Source.append("fixAll");
    $XT.Notebook = $XT.Empty.append("notebook");
    $YT = class $YT2 {
      constructor(range, parent) {
        this.range = range;
        this.parent = parent;
        if (parent && !parent.range.contains(this.range)) {
          throw new Error("Invalid argument: parent must contain this range");
        }
      }
    };
    $YT = __decorate([
      es5ClassCompat
    ], $YT);
    $ZT = class {
      constructor(kind, name, detail, uri, range, selectionRange) {
        this.kind = kind;
        this.name = name;
        this.detail = detail;
        this.uri = uri;
        this.range = range;
        this.selectionRange = selectionRange;
      }
    };
    $1T = class {
      constructor(item, fromRanges) {
        this.fromRanges = fromRanges;
        this.from = item;
      }
    };
    $2T = class {
      constructor(item, fromRanges) {
        this.fromRanges = fromRanges;
        this.to = item;
      }
    };
    (function(LanguageStatusSeverity2) {
      LanguageStatusSeverity2[LanguageStatusSeverity2["Information"] = 0] = "Information";
      LanguageStatusSeverity2[LanguageStatusSeverity2["Warning"] = 1] = "Warning";
      LanguageStatusSeverity2[LanguageStatusSeverity2["Error"] = 2] = "Error";
    })(LanguageStatusSeverity || (LanguageStatusSeverity = {}));
    $3T = class $3T2 {
      constructor(range, command) {
        this.range = range;
        this.command = command;
      }
      get isResolved() {
        return !!this.command;
      }
    };
    $3T = __decorate([
      es5ClassCompat
    ], $3T);
    $4T = $4T_1 = class $4T2 {
      #delegate;
      static isMarkdownString(thing) {
        if (thing instanceof $4T_1) {
          return true;
        }
        return thing && thing.appendCodeblock && thing.appendMarkdown && thing.appendText && thing.value !== void 0;
      }
      constructor(value, supportThemeIcons = false) {
        this.#delegate = new $bm(value, { supportThemeIcons });
      }
      get value() {
        return this.#delegate.value;
      }
      set value(value) {
        this.#delegate.value = value;
      }
      get isTrusted() {
        return this.#delegate.isTrusted;
      }
      set isTrusted(value) {
        this.#delegate.isTrusted = value;
      }
      get supportThemeIcons() {
        return this.#delegate.supportThemeIcons;
      }
      set supportThemeIcons(value) {
        this.#delegate.supportThemeIcons = value;
      }
      get supportHtml() {
        return this.#delegate.supportHtml;
      }
      set supportHtml(value) {
        this.#delegate.supportHtml = value;
      }
      get baseUri() {
        return this.#delegate.baseUri;
      }
      set baseUri(value) {
        this.#delegate.baseUri = value;
      }
      appendText(value) {
        this.#delegate.appendText(value);
        return this;
      }
      appendMarkdown(value) {
        this.#delegate.appendMarkdown(value);
        return this;
      }
      appendCodeblock(value, language) {
        this.#delegate.appendCodeblock(language ?? "", value);
        return this;
      }
    };
    $4T = $4T_1 = __decorate([
      es5ClassCompat
    ], $4T);
    $5T = class $5T2 {
      constructor(label, documentation) {
        this.label = label;
        this.documentation = documentation;
      }
    };
    $5T = __decorate([
      es5ClassCompat
    ], $5T);
    $6T = class $6T2 {
      constructor(label, documentation) {
        this.label = label;
        this.documentation = documentation;
        this.parameters = [];
      }
    };
    $6T = __decorate([
      es5ClassCompat
    ], $6T);
    $7T = class $7T2 {
      constructor() {
        this.activeSignature = 0;
        this.activeParameter = 0;
        this.signatures = [];
      }
    };
    $7T = __decorate([
      es5ClassCompat
    ], $7T);
    (function(SignatureHelpTriggerKind3) {
      SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["Invoke"] = 1] = "Invoke";
      SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["TriggerCharacter"] = 2] = "TriggerCharacter";
      SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["ContentChange"] = 3] = "ContentChange";
    })(SignatureHelpTriggerKind || (SignatureHelpTriggerKind = {}));
    (function(InlayHintKind4) {
      InlayHintKind4[InlayHintKind4["Type"] = 1] = "Type";
      InlayHintKind4[InlayHintKind4["Parameter"] = 2] = "Parameter";
    })(InlayHintKind || (InlayHintKind = {}));
    $8T = class $8T2 {
      constructor(value) {
        this.value = value;
      }
    };
    $8T = __decorate([
      es5ClassCompat
    ], $8T);
    $9T = class $9T2 {
      constructor(position, label, kind) {
        this.position = position;
        this.label = label;
        this.kind = kind;
      }
    };
    $9T = __decorate([
      es5ClassCompat
    ], $9T);
    (function(CompletionTriggerKind4) {
      CompletionTriggerKind4[CompletionTriggerKind4["Invoke"] = 0] = "Invoke";
      CompletionTriggerKind4[CompletionTriggerKind4["TriggerCharacter"] = 1] = "TriggerCharacter";
      CompletionTriggerKind4[CompletionTriggerKind4["TriggerForIncompleteCompletions"] = 2] = "TriggerForIncompleteCompletions";
    })(CompletionTriggerKind || (CompletionTriggerKind = {}));
    (function(CompletionItemKind4) {
      CompletionItemKind4[CompletionItemKind4["Text"] = 0] = "Text";
      CompletionItemKind4[CompletionItemKind4["Method"] = 1] = "Method";
      CompletionItemKind4[CompletionItemKind4["Function"] = 2] = "Function";
      CompletionItemKind4[CompletionItemKind4["Constructor"] = 3] = "Constructor";
      CompletionItemKind4[CompletionItemKind4["Field"] = 4] = "Field";
      CompletionItemKind4[CompletionItemKind4["Variable"] = 5] = "Variable";
      CompletionItemKind4[CompletionItemKind4["Class"] = 6] = "Class";
      CompletionItemKind4[CompletionItemKind4["Interface"] = 7] = "Interface";
      CompletionItemKind4[CompletionItemKind4["Module"] = 8] = "Module";
      CompletionItemKind4[CompletionItemKind4["Property"] = 9] = "Property";
      CompletionItemKind4[CompletionItemKind4["Unit"] = 10] = "Unit";
      CompletionItemKind4[CompletionItemKind4["Value"] = 11] = "Value";
      CompletionItemKind4[CompletionItemKind4["Enum"] = 12] = "Enum";
      CompletionItemKind4[CompletionItemKind4["Keyword"] = 13] = "Keyword";
      CompletionItemKind4[CompletionItemKind4["Snippet"] = 14] = "Snippet";
      CompletionItemKind4[CompletionItemKind4["Color"] = 15] = "Color";
      CompletionItemKind4[CompletionItemKind4["File"] = 16] = "File";
      CompletionItemKind4[CompletionItemKind4["Reference"] = 17] = "Reference";
      CompletionItemKind4[CompletionItemKind4["Folder"] = 18] = "Folder";
      CompletionItemKind4[CompletionItemKind4["EnumMember"] = 19] = "EnumMember";
      CompletionItemKind4[CompletionItemKind4["Constant"] = 20] = "Constant";
      CompletionItemKind4[CompletionItemKind4["Struct"] = 21] = "Struct";
      CompletionItemKind4[CompletionItemKind4["Event"] = 22] = "Event";
      CompletionItemKind4[CompletionItemKind4["Operator"] = 23] = "Operator";
      CompletionItemKind4[CompletionItemKind4["TypeParameter"] = 24] = "TypeParameter";
      CompletionItemKind4[CompletionItemKind4["User"] = 25] = "User";
      CompletionItemKind4[CompletionItemKind4["Issue"] = 26] = "Issue";
    })(CompletionItemKind || (CompletionItemKind = {}));
    (function(CompletionItemTag4) {
      CompletionItemTag4[CompletionItemTag4["Deprecated"] = 1] = "Deprecated";
    })(CompletionItemTag || (CompletionItemTag = {}));
    $0T = class $0T2 {
      constructor(label, kind) {
        this.label = label;
        this.kind = kind;
      }
      toJSON() {
        return {
          label: this.label,
          kind: this.kind && CompletionItemKind[this.kind],
          detail: this.detail,
          documentation: this.documentation,
          sortText: this.sortText,
          filterText: this.filterText,
          preselect: this.preselect,
          insertText: this.insertText,
          textEdit: this.textEdit
        };
      }
    };
    $0T = __decorate([
      es5ClassCompat
    ], $0T);
    $$T = class $$T2 {
      constructor(items = [], isIncomplete = false) {
        this.items = items;
        this.isIncomplete = isIncomplete;
      }
    };
    $$T = __decorate([
      es5ClassCompat
    ], $$T);
    $_T = class $_T2 {
      constructor(insertText, range, command) {
        this.insertText = insertText;
        this.range = range;
        this.command = command;
      }
    };
    $_T = __decorate([
      es5ClassCompat
    ], $_T);
    $aU = class $aU2 {
      constructor(items) {
        this.commands = void 0;
        this.suppressSuggestions = void 0;
        this.items = items;
      }
    };
    $aU = __decorate([
      es5ClassCompat
    ], $aU);
    (function(PartialAcceptTriggerKind4) {
      PartialAcceptTriggerKind4[PartialAcceptTriggerKind4["Unknown"] = 0] = "Unknown";
      PartialAcceptTriggerKind4[PartialAcceptTriggerKind4["Word"] = 1] = "Word";
      PartialAcceptTriggerKind4[PartialAcceptTriggerKind4["Line"] = 2] = "Line";
      PartialAcceptTriggerKind4[PartialAcceptTriggerKind4["Suggest"] = 3] = "Suggest";
    })(PartialAcceptTriggerKind || (PartialAcceptTriggerKind = {}));
    (function(ViewColumn3) {
      ViewColumn3[ViewColumn3["Active"] = -1] = "Active";
      ViewColumn3[ViewColumn3["Beside"] = -2] = "Beside";
      ViewColumn3[ViewColumn3["One"] = 1] = "One";
      ViewColumn3[ViewColumn3["Two"] = 2] = "Two";
      ViewColumn3[ViewColumn3["Three"] = 3] = "Three";
      ViewColumn3[ViewColumn3["Four"] = 4] = "Four";
      ViewColumn3[ViewColumn3["Five"] = 5] = "Five";
      ViewColumn3[ViewColumn3["Six"] = 6] = "Six";
      ViewColumn3[ViewColumn3["Seven"] = 7] = "Seven";
      ViewColumn3[ViewColumn3["Eight"] = 8] = "Eight";
      ViewColumn3[ViewColumn3["Nine"] = 9] = "Nine";
    })(ViewColumn || (ViewColumn = {}));
    (function(StatusBarAlignment2) {
      StatusBarAlignment2[StatusBarAlignment2["Left"] = 1] = "Left";
      StatusBarAlignment2[StatusBarAlignment2["Right"] = 2] = "Right";
    })(StatusBarAlignment || (StatusBarAlignment = {}));
    (function(TextEditorLineNumbersStyle3) {
      TextEditorLineNumbersStyle3[TextEditorLineNumbersStyle3["Off"] = 0] = "Off";
      TextEditorLineNumbersStyle3[TextEditorLineNumbersStyle3["On"] = 1] = "On";
      TextEditorLineNumbersStyle3[TextEditorLineNumbersStyle3["Relative"] = 2] = "Relative";
      TextEditorLineNumbersStyle3[TextEditorLineNumbersStyle3["Interval"] = 3] = "Interval";
    })(TextEditorLineNumbersStyle || (TextEditorLineNumbersStyle = {}));
    (function(TextDocumentSaveReason3) {
      TextDocumentSaveReason3[TextDocumentSaveReason3["Manual"] = 1] = "Manual";
      TextDocumentSaveReason3[TextDocumentSaveReason3["AfterDelay"] = 2] = "AfterDelay";
      TextDocumentSaveReason3[TextDocumentSaveReason3["FocusOut"] = 3] = "FocusOut";
    })(TextDocumentSaveReason || (TextDocumentSaveReason = {}));
    (function(TextEditorRevealType3) {
      TextEditorRevealType3[TextEditorRevealType3["Default"] = 0] = "Default";
      TextEditorRevealType3[TextEditorRevealType3["InCenter"] = 1] = "InCenter";
      TextEditorRevealType3[TextEditorRevealType3["InCenterIfOutsideViewport"] = 2] = "InCenterIfOutsideViewport";
      TextEditorRevealType3[TextEditorRevealType3["AtTop"] = 3] = "AtTop";
    })(TextEditorRevealType || (TextEditorRevealType = {}));
    (function(TextEditorSelectionChangeKind2) {
      TextEditorSelectionChangeKind2[TextEditorSelectionChangeKind2["Keyboard"] = 1] = "Keyboard";
      TextEditorSelectionChangeKind2[TextEditorSelectionChangeKind2["Mouse"] = 2] = "Mouse";
      TextEditorSelectionChangeKind2[TextEditorSelectionChangeKind2["Command"] = 3] = "Command";
    })(TextEditorSelectionChangeKind || (TextEditorSelectionChangeKind = {}));
    (function(TextEditorChangeKind2) {
      TextEditorChangeKind2[TextEditorChangeKind2["Addition"] = 1] = "Addition";
      TextEditorChangeKind2[TextEditorChangeKind2["Deletion"] = 2] = "Deletion";
      TextEditorChangeKind2[TextEditorChangeKind2["Modification"] = 3] = "Modification";
    })(TextEditorChangeKind || (TextEditorChangeKind = {}));
    (function(TextDocumentChangeReason2) {
      TextDocumentChangeReason2[TextDocumentChangeReason2["Undo"] = 1] = "Undo";
      TextDocumentChangeReason2[TextDocumentChangeReason2["Redo"] = 2] = "Redo";
    })(TextDocumentChangeReason || (TextDocumentChangeReason = {}));
    (function(DecorationRangeBehavior3) {
      DecorationRangeBehavior3[DecorationRangeBehavior3["OpenOpen"] = 0] = "OpenOpen";
      DecorationRangeBehavior3[DecorationRangeBehavior3["ClosedClosed"] = 1] = "ClosedClosed";
      DecorationRangeBehavior3[DecorationRangeBehavior3["OpenClosed"] = 2] = "OpenClosed";
      DecorationRangeBehavior3[DecorationRangeBehavior3["ClosedOpen"] = 3] = "ClosedOpen";
    })(DecorationRangeBehavior || (DecorationRangeBehavior = {}));
    (function(TextEditorSelectionChangeKind2) {
      function fromValue(s) {
        switch (s) {
          case "keyboard":
            return TextEditorSelectionChangeKind2.Keyboard;
          case "mouse":
            return TextEditorSelectionChangeKind2.Mouse;
          case "api":
            return TextEditorSelectionChangeKind2.Command;
        }
        return void 0;
      }
      TextEditorSelectionChangeKind2.fromValue = fromValue;
    })(TextEditorSelectionChangeKind || (TextEditorSelectionChangeKind = {}));
    (function(SyntaxTokenType2) {
      SyntaxTokenType2[SyntaxTokenType2["Other"] = 0] = "Other";
      SyntaxTokenType2[SyntaxTokenType2["Comment"] = 1] = "Comment";
      SyntaxTokenType2[SyntaxTokenType2["String"] = 2] = "String";
      SyntaxTokenType2[SyntaxTokenType2["RegEx"] = 3] = "RegEx";
    })(SyntaxTokenType || (SyntaxTokenType = {}));
    (function(SyntaxTokenType2) {
      function toString(v) {
        switch (v) {
          case SyntaxTokenType2.Other:
            return "other";
          case SyntaxTokenType2.Comment:
            return "comment";
          case SyntaxTokenType2.String:
            return "string";
          case SyntaxTokenType2.RegEx:
            return "regex";
        }
        return "other";
      }
      SyntaxTokenType2.toString = toString;
    })(SyntaxTokenType || (SyntaxTokenType = {}));
    $cU = class $cU2 {
      constructor(range, target) {
        if (target && !URI.isUri(target)) {
          throw $nb("target");
        }
        if (!$BT.isRange(range) || range.isEmpty) {
          throw $nb("range");
        }
        this.range = range;
        this.target = target;
      }
    };
    $cU = __decorate([
      es5ClassCompat
    ], $cU);
    $dU = class $dU2 {
      constructor(red, green, blue, alpha) {
        this.red = red;
        this.green = green;
        this.blue = blue;
        this.alpha = alpha;
      }
    };
    $dU = __decorate([
      es5ClassCompat
    ], $dU);
    $eU = class $eU2 {
      constructor(range, color2) {
        if (color2 && !(color2 instanceof $dU)) {
          throw $nb("color");
        }
        if (!$BT.isRange(range) || range.isEmpty) {
          throw $nb("range");
        }
        this.range = range;
        this.color = color2;
      }
    };
    $eU = __decorate([
      es5ClassCompat
    ], $eU);
    $fU = class $fU2 {
      constructor(label) {
        if (!label || typeof label !== "string") {
          throw $nb("label");
        }
        this.label = label;
      }
    };
    $fU = __decorate([
      es5ClassCompat
    ], $fU);
    (function(ColorFormat2) {
      ColorFormat2[ColorFormat2["RGB"] = 0] = "RGB";
      ColorFormat2[ColorFormat2["HEX"] = 1] = "HEX";
      ColorFormat2[ColorFormat2["HSL"] = 2] = "HSL";
    })(ColorFormat || (ColorFormat = {}));
    (function(SourceControlInputBoxValidationType2) {
      SourceControlInputBoxValidationType2[SourceControlInputBoxValidationType2["Error"] = 0] = "Error";
      SourceControlInputBoxValidationType2[SourceControlInputBoxValidationType2["Warning"] = 1] = "Warning";
      SourceControlInputBoxValidationType2[SourceControlInputBoxValidationType2["Information"] = 2] = "Information";
    })(SourceControlInputBoxValidationType || (SourceControlInputBoxValidationType = {}));
    (function(TerminalExitReason3) {
      TerminalExitReason3[TerminalExitReason3["Unknown"] = 0] = "Unknown";
      TerminalExitReason3[TerminalExitReason3["Shutdown"] = 1] = "Shutdown";
      TerminalExitReason3[TerminalExitReason3["Process"] = 2] = "Process";
      TerminalExitReason3[TerminalExitReason3["User"] = 3] = "User";
      TerminalExitReason3[TerminalExitReason3["Extension"] = 4] = "Extension";
    })(TerminalExitReason2 || (TerminalExitReason2 = {}));
    (function(TerminalShellExecutionCommandLineConfidence2) {
      TerminalShellExecutionCommandLineConfidence2[TerminalShellExecutionCommandLineConfidence2["Low"] = 0] = "Low";
      TerminalShellExecutionCommandLineConfidence2[TerminalShellExecutionCommandLineConfidence2["Medium"] = 1] = "Medium";
      TerminalShellExecutionCommandLineConfidence2[TerminalShellExecutionCommandLineConfidence2["High"] = 2] = "High";
    })(TerminalShellExecutionCommandLineConfidence || (TerminalShellExecutionCommandLineConfidence = {}));
    (function(TerminalLocation3) {
      TerminalLocation3[TerminalLocation3["Panel"] = 1] = "Panel";
      TerminalLocation3[TerminalLocation3["Editor"] = 2] = "Editor";
    })(TerminalLocation2 || (TerminalLocation2 = {}));
    (function(TerminalCompletionItemKind2) {
      TerminalCompletionItemKind2[TerminalCompletionItemKind2["File"] = 0] = "File";
      TerminalCompletionItemKind2[TerminalCompletionItemKind2["Folder"] = 1] = "Folder";
      TerminalCompletionItemKind2[TerminalCompletionItemKind2["Flag"] = 2] = "Flag";
      TerminalCompletionItemKind2[TerminalCompletionItemKind2["Method"] = 3] = "Method";
      TerminalCompletionItemKind2[TerminalCompletionItemKind2["Argument"] = 4] = "Argument";
    })(TerminalCompletionItemKind || (TerminalCompletionItemKind = {}));
    (function(TaskRevealKind2) {
      TaskRevealKind2[TaskRevealKind2["Always"] = 1] = "Always";
      TaskRevealKind2[TaskRevealKind2["Silent"] = 2] = "Silent";
      TaskRevealKind2[TaskRevealKind2["Never"] = 3] = "Never";
    })(TaskRevealKind || (TaskRevealKind = {}));
    (function(TaskPanelKind2) {
      TaskPanelKind2[TaskPanelKind2["Shared"] = 1] = "Shared";
      TaskPanelKind2[TaskPanelKind2["Dedicated"] = 2] = "Dedicated";
      TaskPanelKind2[TaskPanelKind2["New"] = 3] = "New";
    })(TaskPanelKind || (TaskPanelKind = {}));
    $mU = class $mU2 {
      static {
        $mU_1 = this;
      }
      static {
        this.Clean = new $mU_1("clean", "Clean");
      }
      static {
        this.Build = new $mU_1("build", "Build");
      }
      static {
        this.Rebuild = new $mU_1("rebuild", "Rebuild");
      }
      static {
        this.Test = new $mU_1("test", "Test");
      }
      static from(value) {
        switch (value) {
          case "clean":
            return $mU_1.Clean;
          case "build":
            return $mU_1.Build;
          case "rebuild":
            return $mU_1.Rebuild;
          case "test":
            return $mU_1.Test;
          default:
            return void 0;
        }
      }
      constructor(id2, label) {
        this.label = label;
        if (typeof id2 !== "string") {
          throw $nb("name");
        }
        if (typeof label !== "string") {
          throw $nb("name");
        }
        this.c = id2;
      }
      get id() {
        return this.c;
      }
    };
    $mU = $mU_1 = __decorate([
      es5ClassCompat
    ], $mU);
    $nU = class $nU2 {
      constructor(process2, varg1, varg2) {
        if (typeof process2 !== "string") {
          throw $nb("process");
        }
        this.e = [];
        this.c = process2;
        if (varg1 !== void 0) {
          if (Array.isArray(varg1)) {
            this.e = varg1;
            this.f = varg2;
          } else {
            this.f = varg1;
          }
        }
      }
      get process() {
        return this.c;
      }
      set process(value) {
        if (typeof value !== "string") {
          throw $nb("process");
        }
        this.c = value;
      }
      get args() {
        return this.e;
      }
      set args(value) {
        if (!Array.isArray(value)) {
          value = [];
        }
        this.e = value;
      }
      get options() {
        return this.f;
      }
      set options(value) {
        this.f = value;
      }
      computeId() {
        const props = [];
        props.push("process");
        if (this.c !== void 0) {
          props.push(this.c);
        }
        if (this.e && this.e.length > 0) {
          for (const arg of this.e) {
            props.push(arg);
          }
        }
        return computeTaskExecutionId(props);
      }
    };
    $nU = __decorate([
      es5ClassCompat
    ], $nU);
    $oU = class $oU2 {
      constructor(arg0, arg1, arg2) {
        this.f = [];
        if (Array.isArray(arg1)) {
          if (!arg0) {
            throw $nb("command can't be undefined or null");
          }
          if (typeof arg0 !== "string" && typeof arg0.value !== "string") {
            throw $nb("command");
          }
          this.e = arg0;
          this.f = arg1;
          this.g = arg2;
        } else {
          if (typeof arg0 !== "string") {
            throw $nb("commandLine");
          }
          this.c = arg0;
          this.g = arg1;
        }
      }
      get commandLine() {
        return this.c;
      }
      set commandLine(value) {
        if (typeof value !== "string") {
          throw $nb("commandLine");
        }
        this.c = value;
      }
      get command() {
        return this.e ? this.e : "";
      }
      set command(value) {
        if (typeof value !== "string" && typeof value.value !== "string") {
          throw $nb("command");
        }
        this.e = value;
      }
      get args() {
        return this.f;
      }
      set args(value) {
        this.f = value || [];
      }
      get options() {
        return this.g;
      }
      set options(value) {
        this.g = value;
      }
      computeId() {
        const props = [];
        props.push("shell");
        if (this.c !== void 0) {
          props.push(this.c);
        }
        if (this.e !== void 0) {
          props.push(typeof this.e === "string" ? this.e : this.e.value);
        }
        if (this.f && this.f.length > 0) {
          for (const arg of this.f) {
            props.push(typeof arg === "string" ? arg : arg.value);
          }
        }
        return computeTaskExecutionId(props);
      }
    };
    $oU = __decorate([
      es5ClassCompat
    ], $oU);
    (function(ShellQuoting2) {
      ShellQuoting2[ShellQuoting2["Escape"] = 1] = "Escape";
      ShellQuoting2[ShellQuoting2["Strong"] = 2] = "Strong";
      ShellQuoting2[ShellQuoting2["Weak"] = 3] = "Weak";
    })(ShellQuoting || (ShellQuoting = {}));
    (function(TaskScope2) {
      TaskScope2[TaskScope2["Global"] = 1] = "Global";
      TaskScope2[TaskScope2["Workspace"] = 2] = "Workspace";
    })(TaskScope || (TaskScope = {}));
    $pU = class {
      constructor(callback) {
        this.c = callback;
      }
      computeId() {
        return "customExecution" + $ps();
      }
      set callback(value) {
        this.c = value;
      }
      get callback() {
        return this.c;
      }
    };
    $qU = class $qU2 {
      static {
        $qU_1 = this;
      }
      static {
        this.c = "customExecution";
      }
      static {
        this.e = "process";
      }
      static {
        this.f = "shell";
      }
      static {
        this.g = "$empty";
      }
      constructor(definition, arg2, arg3, arg4, arg5, arg6) {
        this.k = false;
        this.l = this.definition = definition;
        let problemMatchers;
        if (typeof arg2 === "string") {
          this.o = this.name = arg2;
          this.w = this.source = arg3;
          this.execution = arg4;
          problemMatchers = arg5;
          this.k = true;
        } else if (arg2 === TaskScope.Global || arg2 === TaskScope.Workspace) {
          this.target = arg2;
          this.o = this.name = arg3;
          this.w = this.source = arg4;
          this.execution = arg5;
          problemMatchers = arg6;
        } else {
          this.target = arg2;
          this.o = this.name = arg3;
          this.w = this.source = arg4;
          this.execution = arg5;
          problemMatchers = arg6;
        }
        if (typeof problemMatchers === "string") {
          this.r = [problemMatchers];
          this.t = true;
        } else if (Array.isArray(problemMatchers)) {
          this.r = problemMatchers;
          this.t = true;
        } else {
          this.r = [];
          this.t = false;
        }
        this.u = false;
        this.y = /* @__PURE__ */ Object.create(null);
        this.z = /* @__PURE__ */ Object.create(null);
      }
      get _id() {
        return this.j;
      }
      set _id(value) {
        this.j = value;
      }
      get _deprecated() {
        return this.k;
      }
      B() {
        if (this.j === void 0) {
          return;
        }
        this.j = void 0;
        this.m = void 0;
        this.C();
      }
      C() {
        if (this.q instanceof $nU) {
          this.l = {
            type: $qU_1.e,
            id: this.q.computeId()
          };
        } else if (this.q instanceof $oU) {
          this.l = {
            type: $qU_1.f,
            id: this.q.computeId()
          };
        } else if (this.q instanceof $pU) {
          this.l = {
            type: $qU_1.c,
            id: this.q.computeId()
          };
        } else {
          this.l = {
            type: $qU_1.g,
            id: $ps()
          };
        }
      }
      get definition() {
        return this.l;
      }
      set definition(value) {
        if (value === void 0 || value === null) {
          throw $nb("Kind can't be undefined or null");
        }
        this.B();
        this.l = value;
      }
      get scope() {
        return this.m;
      }
      set target(value) {
        this.B();
        this.m = value;
      }
      get name() {
        return this.o;
      }
      set name(value) {
        if (typeof value !== "string") {
          throw $nb("name");
        }
        this.B();
        this.o = value;
      }
      get execution() {
        return this.q;
      }
      set execution(value) {
        if (value === null) {
          value = void 0;
        }
        this.B();
        this.q = value;
        const type2 = this.l.type;
        if ($qU_1.g === type2 || $qU_1.e === type2 || $qU_1.f === type2 || $qU_1.c === type2) {
          this.C();
        }
      }
      get problemMatchers() {
        return this.r;
      }
      set problemMatchers(value) {
        if (!Array.isArray(value)) {
          this.B();
          this.r = [];
          this.t = false;
          return;
        } else {
          this.B();
          this.r = value;
          this.t = true;
        }
      }
      get hasDefinedMatchers() {
        return this.t;
      }
      get isBackground() {
        return this.u;
      }
      set isBackground(value) {
        if (value !== true && value !== false) {
          value = false;
        }
        this.B();
        this.u = value;
      }
      get source() {
        return this.w;
      }
      set source(value) {
        if (typeof value !== "string" || value.length === 0) {
          throw $nb("source must be a string of length > 0");
        }
        this.B();
        this.w = value;
      }
      get group() {
        return this.x;
      }
      set group(value) {
        if (value === null) {
          value = void 0;
        }
        this.B();
        this.x = value;
      }
      get detail() {
        return this.A;
      }
      set detail(value) {
        if (value === null) {
          value = void 0;
        }
        this.A = value;
      }
      get presentationOptions() {
        return this.y;
      }
      set presentationOptions(value) {
        if (value === null || value === void 0) {
          value = /* @__PURE__ */ Object.create(null);
        }
        this.B();
        this.y = value;
      }
      get runOptions() {
        return this.z;
      }
      set runOptions(value) {
        if (value === null || value === void 0) {
          value = /* @__PURE__ */ Object.create(null);
        }
        this.B();
        this.z = value;
      }
    };
    $qU = $qU_1 = __decorate([
      es5ClassCompat
    ], $qU);
    (function(ProgressLocation3) {
      ProgressLocation3[ProgressLocation3["SourceControl"] = 1] = "SourceControl";
      ProgressLocation3[ProgressLocation3["Window"] = 10] = "Window";
      ProgressLocation3[ProgressLocation3["Notification"] = 15] = "Notification";
    })(ProgressLocation || (ProgressLocation = {}));
    (function(ViewBadge3) {
      function isViewBadge(thing) {
        const viewBadgeThing = thing;
        if (!$Dg(viewBadgeThing.value)) {
          console.log("INVALID view badge, invalid value", viewBadgeThing.value);
          return false;
        }
        if (viewBadgeThing.tooltip && !$zg(viewBadgeThing.tooltip)) {
          console.log("INVALID view badge, invalid tooltip", viewBadgeThing.tooltip);
          return false;
        }
        return true;
      }
      ViewBadge3.isViewBadge = isViewBadge;
    })(ViewBadge || (ViewBadge = {}));
    $rU = $rU_1 = class $rU2 {
      static isTreeItem(thing, extension) {
        const treeItemThing = thing;
        if (treeItemThing.checkboxState !== void 0) {
          const checkbox = $Dg(treeItemThing.checkboxState) ? treeItemThing.checkboxState : $Bg(treeItemThing.checkboxState) && $Dg(treeItemThing.checkboxState.state) ? treeItemThing.checkboxState.state : void 0;
          const tooltip = !$Dg(treeItemThing.checkboxState) && $Bg(treeItemThing.checkboxState) ? treeItemThing.checkboxState.tooltip : void 0;
          if (checkbox === void 0 || checkbox !== TreeItemCheckboxState.Checked && checkbox !== TreeItemCheckboxState.Unchecked || tooltip !== void 0 && !$zg(tooltip)) {
            console.log("INVALID tree item, invalid checkboxState", treeItemThing.checkboxState);
            return false;
          }
        }
        if (thing instanceof $rU_1) {
          return true;
        }
        if (treeItemThing.label !== void 0 && !$zg(treeItemThing.label) && !treeItemThing.label?.label) {
          console.log("INVALID tree item, invalid label", treeItemThing.label);
          return false;
        }
        if (treeItemThing.id !== void 0 && !$zg(treeItemThing.id)) {
          console.log("INVALID tree item, invalid id", treeItemThing.id);
          return false;
        }
        if (treeItemThing.iconPath !== void 0 && !$zg(treeItemThing.iconPath) && !URI.isUri(treeItemThing.iconPath) && (!treeItemThing.iconPath || !$zg(treeItemThing.iconPath.id))) {
          const asLightAndDarkThing = treeItemThing.iconPath;
          if (!asLightAndDarkThing || !$zg(asLightAndDarkThing.light) && !URI.isUri(asLightAndDarkThing.light) && !$zg(asLightAndDarkThing.dark) && !URI.isUri(asLightAndDarkThing.dark)) {
            console.log("INVALID tree item, invalid iconPath", treeItemThing.iconPath);
            return false;
          }
        }
        if (treeItemThing.description !== void 0 && !$zg(treeItemThing.description) && typeof treeItemThing.description !== "boolean") {
          console.log("INVALID tree item, invalid description", treeItemThing.description);
          return false;
        }
        if (treeItemThing.resourceUri !== void 0 && !URI.isUri(treeItemThing.resourceUri)) {
          console.log("INVALID tree item, invalid resourceUri", treeItemThing.resourceUri);
          return false;
        }
        if (treeItemThing.tooltip !== void 0 && !$zg(treeItemThing.tooltip) && !(treeItemThing.tooltip instanceof $4T)) {
          console.log("INVALID tree item, invalid tooltip", treeItemThing.tooltip);
          return false;
        }
        if (treeItemThing.command !== void 0 && !treeItemThing.command.command) {
          console.log("INVALID tree item, invalid command", treeItemThing.command);
          return false;
        }
        if (treeItemThing.collapsibleState !== void 0 && treeItemThing.collapsibleState < TreeItemCollapsibleState.None && treeItemThing.collapsibleState > TreeItemCollapsibleState.Expanded) {
          console.log("INVALID tree item, invalid collapsibleState", treeItemThing.collapsibleState);
          return false;
        }
        if (treeItemThing.contextValue !== void 0 && !$zg(treeItemThing.contextValue)) {
          console.log("INVALID tree item, invalid contextValue", treeItemThing.contextValue);
          return false;
        }
        if (treeItemThing.accessibilityInformation !== void 0 && !treeItemThing.accessibilityInformation?.label) {
          console.log("INVALID tree item, invalid accessibilityInformation", treeItemThing.accessibilityInformation);
          return false;
        }
        return true;
      }
      constructor(arg1, collapsibleState = TreeItemCollapsibleState.None) {
        this.collapsibleState = collapsibleState;
        if (URI.isUri(arg1)) {
          this.resourceUri = arg1;
        } else {
          this.label = arg1;
        }
      }
    };
    $rU = $rU_1 = __decorate([
      es5ClassCompat
    ], $rU);
    (function(TreeItemCollapsibleState2) {
      TreeItemCollapsibleState2[TreeItemCollapsibleState2["None"] = 0] = "None";
      TreeItemCollapsibleState2[TreeItemCollapsibleState2["Collapsed"] = 1] = "Collapsed";
      TreeItemCollapsibleState2[TreeItemCollapsibleState2["Expanded"] = 2] = "Expanded";
    })(TreeItemCollapsibleState || (TreeItemCollapsibleState = {}));
    (function(TreeItemCheckboxState2) {
      TreeItemCheckboxState2[TreeItemCheckboxState2["Unchecked"] = 0] = "Unchecked";
      TreeItemCheckboxState2[TreeItemCheckboxState2["Checked"] = 1] = "Checked";
    })(TreeItemCheckboxState || (TreeItemCheckboxState = {}));
    $sU = class $sU2 {
      async asString() {
        return typeof this.value === "string" ? this.value : JSON.stringify(this.value);
      }
      asFile() {
        return void 0;
      }
      constructor(value) {
        this.value = value;
      }
    };
    $sU = __decorate([
      es5ClassCompat
    ], $sU);
    $tU = class extends $sU {
    };
    $uU = class extends $tU {
      #file;
      constructor(file) {
        super("");
        this.#file = file;
      }
      asFile() {
        return this.#file;
      }
    };
    $vU = class {
      constructor(name, uri, itemId, getData) {
        this.name = name;
        this.uri = uri;
        this._itemId = itemId;
        this.c = getData;
      }
      data() {
        return this.c();
      }
    };
    $wU = class $wU2 {
      #items = /* @__PURE__ */ new Map();
      constructor(init) {
        for (const [mime, item] of init ?? []) {
          const existing = this.#items.get(this.#normalizeMime(mime));
          if (existing) {
            existing.push(item);
          } else {
            this.#items.set(this.#normalizeMime(mime), [item]);
          }
        }
      }
      get(mimeType) {
        return this.#items.get(this.#normalizeMime(mimeType))?.[0];
      }
      set(mimeType, value) {
        this.#items.set(this.#normalizeMime(mimeType), [value]);
      }
      forEach(callbackfn, thisArg) {
        for (const [mime, items] of this.#items) {
          for (const item of items) {
            callbackfn.call(thisArg, item, mime, this);
          }
        }
      }
      *[Symbol.iterator]() {
        for (const [mime, items] of this.#items) {
          for (const item of items) {
            yield [mime, item];
          }
        }
      }
      #normalizeMime(mimeType) {
        return mimeType.toLowerCase();
      }
    };
    $wU = __decorate([
      es5ClassCompat
    ], $wU);
    $xU = class $xU2 {
      constructor(insertText, title, kind) {
        this.insertText = insertText;
        this.title = title;
        this.kind = kind;
      }
    };
    $xU = __decorate([
      es5ClassCompat
    ], $xU);
    (function(DocumentPasteTriggerKind3) {
      DocumentPasteTriggerKind3[DocumentPasteTriggerKind3["Automatic"] = 0] = "Automatic";
      DocumentPasteTriggerKind3[DocumentPasteTriggerKind3["PasteAs"] = 1] = "PasteAs";
    })(DocumentPasteTriggerKind || (DocumentPasteTriggerKind = {}));
    $yU = class _$yU {
      static {
        this.c = ".";
      }
      constructor(value) {
        this.value = value;
      }
      append(...parts) {
        return new _$yU((this.value ? [this.value, ...parts] : parts).join(_$yU.c));
      }
      intersects(other) {
        return this.contains(other) || other.contains(this);
      }
      contains(other) {
        return this.value === other.value || other.value.startsWith(this.value + _$yU.c);
      }
    };
    $yU.Empty = new $yU("");
    $yU.Text = new $yU("text");
    $AU = class $AU2 {
      constructor(id2, color2) {
        this.id = id2;
        this.color = color2;
      }
      static isThemeIcon(thing) {
        if (typeof thing.id !== "string") {
          console.log("INVALID ThemeIcon, invalid id", thing.id);
          return false;
        }
        return true;
      }
    };
    $AU = __decorate([
      es5ClassCompat
    ], $AU);
    $AU.File = new $AU("file");
    $AU.Folder = new $AU("folder");
    $BU = class $BU2 {
      constructor(id2) {
        this.id = id2;
      }
    };
    $BU = __decorate([
      es5ClassCompat
    ], $BU);
    (function(ConfigurationTarget3) {
      ConfigurationTarget3[ConfigurationTarget3["Global"] = 1] = "Global";
      ConfigurationTarget3[ConfigurationTarget3["Workspace"] = 2] = "Workspace";
      ConfigurationTarget3[ConfigurationTarget3["WorkspaceFolder"] = 3] = "WorkspaceFolder";
    })(ConfigurationTarget2 || (ConfigurationTarget2 = {}));
    $CU = class $CU2 {
      get base() {
        return this.c;
      }
      set base(base) {
        this.c = base;
        this.e = URI.file(base);
      }
      get baseUri() {
        return this.e;
      }
      set baseUri(baseUri) {
        this.e = baseUri;
        this.c = baseUri.fsPath;
      }
      constructor(base, pattern) {
        if (typeof base !== "string") {
          if (!base || !URI.isUri(base) && !URI.isUri(base.uri)) {
            throw $nb("base");
          }
        }
        if (typeof pattern !== "string") {
          throw $nb("pattern");
        }
        if (typeof base === "string") {
          this.baseUri = URI.file(base);
        } else if (URI.isUri(base)) {
          this.baseUri = base;
        } else {
          this.baseUri = base.uri;
        }
        this.pattern = pattern;
      }
      toJSON() {
        return {
          pattern: this.pattern,
          base: this.base,
          baseUri: this.baseUri.toJSON()
        };
      }
    };
    $CU = __decorate([
      es5ClassCompat
    ], $CU);
    breakpointIds = /* @__PURE__ */ new WeakMap();
    $EU = class $EU2 {
      constructor(enabled, condition, hitCondition, logMessage, mode) {
        this.enabled = typeof enabled === "boolean" ? enabled : true;
        if (typeof condition === "string") {
          this.condition = condition;
        }
        if (typeof hitCondition === "string") {
          this.hitCondition = hitCondition;
        }
        if (typeof logMessage === "string") {
          this.logMessage = logMessage;
        }
        if (typeof mode === "string") {
          this.mode = mode;
        }
      }
      get id() {
        if (!this.c) {
          this.c = breakpointIds.get(this) ?? $ps();
        }
        return this.c;
      }
    };
    $EU = __decorate([
      es5ClassCompat
    ], $EU);
    $FU = class $FU2 extends $EU {
      constructor(location2, enabled, condition, hitCondition, logMessage, mode) {
        super(enabled, condition, hitCondition, logMessage, mode);
        if (location2 === null) {
          throw $nb("location");
        }
        this.location = location2;
      }
    };
    $FU = __decorate([
      es5ClassCompat
    ], $FU);
    $GU = class $GU2 extends $EU {
      constructor(functionName, enabled, condition, hitCondition, logMessage, mode) {
        super(enabled, condition, hitCondition, logMessage, mode);
        this.functionName = functionName;
      }
    };
    $GU = __decorate([
      es5ClassCompat
    ], $GU);
    $HU = class $HU2 extends $EU {
      constructor(label, dataId, canPersist, enabled, condition, hitCondition, logMessage, mode) {
        super(enabled, condition, hitCondition, logMessage, mode);
        if (!dataId) {
          throw $nb("dataId");
        }
        this.label = label;
        this.dataId = dataId;
        this.canPersist = canPersist;
      }
    };
    $HU = __decorate([
      es5ClassCompat
    ], $HU);
    $IU = class $IU2 {
      constructor(command, args, options2) {
        this.command = command;
        this.args = args || [];
        this.options = options2;
      }
    };
    $IU = __decorate([
      es5ClassCompat
    ], $IU);
    $JU = class $JU2 {
      constructor(port, host) {
        this.port = port;
        this.host = host;
      }
    };
    $JU = __decorate([
      es5ClassCompat
    ], $JU);
    $KU = class $KU2 {
      constructor(path7) {
        this.path = path7;
      }
    };
    $KU = __decorate([
      es5ClassCompat
    ], $KU);
    $LU = class $LU2 {
      constructor(impl) {
        this.implementation = impl;
      }
    };
    $LU = __decorate([
      es5ClassCompat
    ], $LU);
    $OU = class $OU2 {
      constructor(range, expression) {
        this.range = range;
        this.expression = expression;
      }
    };
    $OU = __decorate([
      es5ClassCompat
    ], $OU);
    (function(InlineCompletionTriggerKind3) {
      InlineCompletionTriggerKind3[InlineCompletionTriggerKind3["Invoke"] = 0] = "Invoke";
      InlineCompletionTriggerKind3[InlineCompletionTriggerKind3["Automatic"] = 1] = "Automatic";
    })(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));
    $PU = class $PU2 {
      constructor(range, text) {
        this.range = range;
        this.text = text;
      }
    };
    $PU = __decorate([
      es5ClassCompat
    ], $PU);
    $QU = class $QU2 {
      constructor(range, variableName, caseSensitiveLookup = true) {
        this.range = range;
        this.variableName = variableName;
        this.caseSensitiveLookup = caseSensitiveLookup;
      }
    };
    $QU = __decorate([
      es5ClassCompat
    ], $QU);
    $RU = class $RU2 {
      constructor(range, expression) {
        this.range = range;
        this.expression = expression;
      }
    };
    $RU = __decorate([
      es5ClassCompat
    ], $RU);
    $SU = class $SU2 {
      constructor(frameId, range) {
        this.frameId = frameId;
        this.stoppedLocation = range;
      }
    };
    $SU = __decorate([
      es5ClassCompat
    ], $SU);
    (function(NewSymbolNameTag3) {
      NewSymbolNameTag3[NewSymbolNameTag3["AIGenerated"] = 1] = "AIGenerated";
    })(NewSymbolNameTag || (NewSymbolNameTag = {}));
    (function(NewSymbolNameTriggerKind3) {
      NewSymbolNameTriggerKind3[NewSymbolNameTriggerKind3["Invoke"] = 0] = "Invoke";
      NewSymbolNameTriggerKind3[NewSymbolNameTriggerKind3["Automatic"] = 1] = "Automatic";
    })(NewSymbolNameTriggerKind || (NewSymbolNameTriggerKind = {}));
    (function(FileChangeType3) {
      FileChangeType3[FileChangeType3["Changed"] = 1] = "Changed";
      FileChangeType3[FileChangeType3["Created"] = 2] = "Created";
      FileChangeType3[FileChangeType3["Deleted"] = 3] = "Deleted";
    })(FileChangeType2 || (FileChangeType2 = {}));
    $UU = $UU_1 = class $UU2 extends Error {
      static FileExists(messageOrUri) {
        return new $UU_1(messageOrUri, FileSystemProviderErrorCode.FileExists, $UU_1.FileExists);
      }
      static FileNotFound(messageOrUri) {
        return new $UU_1(messageOrUri, FileSystemProviderErrorCode.FileNotFound, $UU_1.FileNotFound);
      }
      static FileNotADirectory(messageOrUri) {
        return new $UU_1(messageOrUri, FileSystemProviderErrorCode.FileNotADirectory, $UU_1.FileNotADirectory);
      }
      static FileIsADirectory(messageOrUri) {
        return new $UU_1(messageOrUri, FileSystemProviderErrorCode.FileIsADirectory, $UU_1.FileIsADirectory);
      }
      static NoPermissions(messageOrUri) {
        return new $UU_1(messageOrUri, FileSystemProviderErrorCode.NoPermissions, $UU_1.NoPermissions);
      }
      static Unavailable(messageOrUri) {
        return new $UU_1(messageOrUri, FileSystemProviderErrorCode.Unavailable, $UU_1.Unavailable);
      }
      constructor(uriOrMessage, code = FileSystemProviderErrorCode.Unknown, terminator) {
        super(URI.isUri(uriOrMessage) ? uriOrMessage.toString(true) : uriOrMessage);
        this.code = terminator?.name ?? "Unknown";
        $zm(this, code);
        Object.setPrototypeOf(this, $UU_1.prototype);
        if (typeof Error.captureStackTrace === "function" && typeof terminator === "function") {
          Error.captureStackTrace(this, terminator);
        }
      }
    };
    $UU = $UU_1 = __decorate([
      es5ClassCompat
    ], $UU);
    $VU = class $VU2 {
      constructor(start, end, kind) {
        this.start = start;
        this.end = end;
        this.kind = kind;
      }
    };
    $VU = __decorate([
      es5ClassCompat
    ], $VU);
    (function(FoldingRangeKind3) {
      FoldingRangeKind3[FoldingRangeKind3["Comment"] = 1] = "Comment";
      FoldingRangeKind3[FoldingRangeKind3["Imports"] = 2] = "Imports";
      FoldingRangeKind3[FoldingRangeKind3["Region"] = 3] = "Region";
    })(FoldingRangeKind || (FoldingRangeKind = {}));
    (function(CommentThreadCollapsibleState3) {
      CommentThreadCollapsibleState3[CommentThreadCollapsibleState3["Collapsed"] = 0] = "Collapsed";
      CommentThreadCollapsibleState3[CommentThreadCollapsibleState3["Expanded"] = 1] = "Expanded";
    })(CommentThreadCollapsibleState || (CommentThreadCollapsibleState = {}));
    (function(CommentMode3) {
      CommentMode3[CommentMode3["Editing"] = 0] = "Editing";
      CommentMode3[CommentMode3["Preview"] = 1] = "Preview";
    })(CommentMode || (CommentMode = {}));
    (function(CommentState3) {
      CommentState3[CommentState3["Published"] = 0] = "Published";
      CommentState3[CommentState3["Draft"] = 1] = "Draft";
    })(CommentState || (CommentState = {}));
    (function(CommentThreadState3) {
      CommentThreadState3[CommentThreadState3["Unresolved"] = 0] = "Unresolved";
      CommentThreadState3[CommentThreadState3["Resolved"] = 1] = "Resolved";
    })(CommentThreadState || (CommentThreadState = {}));
    (function(CommentThreadApplicability3) {
      CommentThreadApplicability3[CommentThreadApplicability3["Current"] = 0] = "Current";
      CommentThreadApplicability3[CommentThreadApplicability3["Outdated"] = 1] = "Outdated";
    })(CommentThreadApplicability || (CommentThreadApplicability = {}));
    (function(CommentThreadFocus2) {
      CommentThreadFocus2[CommentThreadFocus2["Reply"] = 1] = "Reply";
      CommentThreadFocus2[CommentThreadFocus2["Comment"] = 2] = "Comment";
    })(CommentThreadFocus || (CommentThreadFocus = {}));
    (function(DebugConsoleMode2) {
      DebugConsoleMode2[DebugConsoleMode2["Separate"] = 0] = "Separate";
      DebugConsoleMode2[DebugConsoleMode2["MergeWithParent"] = 1] = "MergeWithParent";
    })(DebugConsoleMode || (DebugConsoleMode = {}));
    (function(QuickInputButtonLocation2) {
      QuickInputButtonLocation2[QuickInputButtonLocation2["Title"] = 1] = "Title";
      QuickInputButtonLocation2[QuickInputButtonLocation2["Inline"] = 2] = "Inline";
    })(QuickInputButtonLocation || (QuickInputButtonLocation = {}));
    $3U = class $3U2 {
      static {
        this.Back = { iconPath: new $AU("arrow-left") };
      }
      constructor() {
      }
    };
    $3U = __decorate([
      es5ClassCompat
    ], $3U);
    (function(QuickPickItemKind2) {
      QuickPickItemKind2[QuickPickItemKind2["Separator"] = -1] = "Separator";
      QuickPickItemKind2[QuickPickItemKind2["Default"] = 0] = "Default";
    })(QuickPickItemKind || (QuickPickItemKind = {}));
    (function(InputBoxValidationSeverity2) {
      InputBoxValidationSeverity2[InputBoxValidationSeverity2["Info"] = 1] = "Info";
      InputBoxValidationSeverity2[InputBoxValidationSeverity2["Warning"] = 2] = "Warning";
      InputBoxValidationSeverity2[InputBoxValidationSeverity2["Error"] = 3] = "Error";
    })(InputBoxValidationSeverity || (InputBoxValidationSeverity = {}));
    (function(ExtensionKind2) {
      ExtensionKind2[ExtensionKind2["UI"] = 1] = "UI";
      ExtensionKind2[ExtensionKind2["Workspace"] = 2] = "Workspace";
    })(ExtensionKind || (ExtensionKind = {}));
    $5U = class $5U2 {
      constructor(kind) {
        this.kind = kind;
      }
    };
    $5U = __decorate([
      es5ClassCompat
    ], $5U);
    (function(ColorThemeKind2) {
      ColorThemeKind2[ColorThemeKind2["Light"] = 1] = "Light";
      ColorThemeKind2[ColorThemeKind2["Dark"] = 2] = "Dark";
      ColorThemeKind2[ColorThemeKind2["HighContrast"] = 3] = "HighContrast";
      ColorThemeKind2[ColorThemeKind2["HighContrastLight"] = 4] = "HighContrastLight";
    })(ColorThemeKind || (ColorThemeKind = {}));
    $6U = class _$6U {
      static isNotebookRange(thing) {
        if (thing instanceof _$6U) {
          return true;
        }
        if (!thing) {
          return false;
        }
        return typeof thing.start === "number" && typeof thing.end === "number";
      }
      get start() {
        return this.c;
      }
      get end() {
        return this.e;
      }
      get isEmpty() {
        return this.c === this.e;
      }
      constructor(start, end) {
        if (start < 0) {
          throw $nb("start must be positive");
        }
        if (end < 0) {
          throw $nb("end must be positive");
        }
        if (start <= end) {
          this.c = start;
          this.e = end;
        } else {
          this.c = end;
          this.e = start;
        }
      }
      with(change) {
        let start = this.c;
        let end = this.e;
        if (change.start !== void 0) {
          start = change.start;
        }
        if (change.end !== void 0) {
          end = change.end;
        }
        if (start === this.c && end === this.e) {
          return this;
        }
        return new _$6U(start, end);
      }
    };
    $7U = class _$7U {
      static validate(data) {
        if (typeof data.kind !== "number") {
          throw new Error("NotebookCellData MUST have 'kind' property");
        }
        if (typeof data.value !== "string") {
          throw new Error("NotebookCellData MUST have 'value' property");
        }
        if (typeof data.languageId !== "string") {
          throw new Error("NotebookCellData MUST have 'languageId' property");
        }
      }
      static isNotebookCellDataArray(value) {
        return Array.isArray(value) && value.every((elem) => _$7U.isNotebookCellData(elem));
      }
      static isNotebookCellData(value) {
        return true;
      }
      constructor(kind, value, languageId, mime, outputs, metadata, executionSummary) {
        this.kind = kind;
        this.value = value;
        this.languageId = languageId;
        this.mime = mime;
        this.outputs = outputs ?? [];
        this.metadata = metadata;
        this.executionSummary = executionSummary;
        _$7U.validate(this);
      }
    };
    $8U = class {
      constructor(cells) {
        this.cells = cells;
      }
    };
    $9U = class _$9U {
      static isNotebookCellOutputItem(obj) {
        if (obj instanceof _$9U) {
          return true;
        }
        if (!obj) {
          return false;
        }
        return typeof obj.mime === "string" && obj.data instanceof Uint8Array;
      }
      static error(err) {
        const obj = {
          name: err.name,
          message: err.message,
          stack: err.stack
        };
        return _$9U.json(obj, "application/vnd.code.notebook.error");
      }
      static stdout(value) {
        return _$9U.text(value, "application/vnd.code.notebook.stdout");
      }
      static stderr(value) {
        return _$9U.text(value, "application/vnd.code.notebook.stderr");
      }
      static bytes(value, mime = "application/octet-stream") {
        return new _$9U(value, mime);
      }
      static #encoder = new TextEncoder();
      static text(value, mime = $YC.text) {
        const bytes = _$9U.#encoder.encode(String(value));
        return new _$9U(bytes, mime);
      }
      static json(value, mime = "text/x-json") {
        const rawStr = JSON.stringify(value, void 0, "	");
        return _$9U.text(rawStr, mime);
      }
      constructor(data, mime) {
        this.data = data;
        this.mime = mime;
        const mimeNormalized = $3C(mime, true);
        if (!mimeNormalized) {
          throw new Error(`INVALID mime type: ${mime}. Must be in the format "type/subtype[;optionalparameter]"`);
        }
        this.mime = mimeNormalized;
      }
    };
    $0U = class _$0U {
      static isNotebookCellOutput(candidate) {
        if (candidate instanceof _$0U) {
          return true;
        }
        if (!candidate || typeof candidate !== "object") {
          return false;
        }
        return typeof candidate.id === "string" && Array.isArray(candidate.items);
      }
      static ensureUniqueMimeTypes(items, warn = false) {
        const seen = /* @__PURE__ */ new Set();
        const removeIdx = /* @__PURE__ */ new Set();
        for (let i = 0; i < items.length; i++) {
          const item = items[i];
          const normalMime = $3C(item.mime);
          if (!seen.has(normalMime) || $tM(normalMime)) {
            seen.add(normalMime);
            continue;
          }
          removeIdx.add(i);
          if (warn) {
            console.warn(`DUPLICATED mime type '${item.mime}' will be dropped`);
          }
        }
        if (removeIdx.size === 0) {
          return items;
        }
        return items.filter((_item, index) => !removeIdx.has(index));
      }
      constructor(items, idOrMetadata, metadata) {
        this.items = _$0U.ensureUniqueMimeTypes(items, true);
        if (typeof idOrMetadata === "string") {
          this.id = idOrMetadata;
          this.metadata = metadata;
        } else {
          this.id = $ps();
          this.metadata = idOrMetadata ?? metadata;
        }
      }
    };
    (function(NotebookCellKind3) {
      NotebookCellKind3[NotebookCellKind3["Markup"] = 1] = "Markup";
      NotebookCellKind3[NotebookCellKind3["Code"] = 2] = "Code";
    })(NotebookCellKind || (NotebookCellKind = {}));
    (function(NotebookCellExecutionState4) {
      NotebookCellExecutionState4[NotebookCellExecutionState4["Idle"] = 1] = "Idle";
      NotebookCellExecutionState4[NotebookCellExecutionState4["Pending"] = 2] = "Pending";
      NotebookCellExecutionState4[NotebookCellExecutionState4["Executing"] = 3] = "Executing";
    })(NotebookCellExecutionState2 || (NotebookCellExecutionState2 = {}));
    (function(NotebookCellStatusBarAlignment2) {
      NotebookCellStatusBarAlignment2[NotebookCellStatusBarAlignment2["Left"] = 1] = "Left";
      NotebookCellStatusBarAlignment2[NotebookCellStatusBarAlignment2["Right"] = 2] = "Right";
    })(NotebookCellStatusBarAlignment || (NotebookCellStatusBarAlignment = {}));
    (function(NotebookEditorRevealType3) {
      NotebookEditorRevealType3[NotebookEditorRevealType3["Default"] = 0] = "Default";
      NotebookEditorRevealType3[NotebookEditorRevealType3["InCenter"] = 1] = "InCenter";
      NotebookEditorRevealType3[NotebookEditorRevealType3["InCenterIfOutsideViewport"] = 2] = "InCenterIfOutsideViewport";
      NotebookEditorRevealType3[NotebookEditorRevealType3["AtTop"] = 3] = "AtTop";
    })(NotebookEditorRevealType || (NotebookEditorRevealType = {}));
    (function(NotebookControllerAffinity3) {
      NotebookControllerAffinity3[NotebookControllerAffinity3["Default"] = 1] = "Default";
      NotebookControllerAffinity3[NotebookControllerAffinity3["Preferred"] = 2] = "Preferred";
    })(NotebookControllerAffinity || (NotebookControllerAffinity = {}));
    (function(NotebookControllerAffinity22) {
      NotebookControllerAffinity22[NotebookControllerAffinity22["Default"] = 1] = "Default";
      NotebookControllerAffinity22[NotebookControllerAffinity22["Preferred"] = 2] = "Preferred";
      NotebookControllerAffinity22[NotebookControllerAffinity22["Hidden"] = -1] = "Hidden";
    })(NotebookControllerAffinity2 || (NotebookControllerAffinity2 = {}));
    $aV = class {
      constructor(uri, provides = []) {
        this.uri = uri;
        this.provides = $5b(provides);
      }
    };
    (function(NotebookVariablesRequestKind2) {
      NotebookVariablesRequestKind2[NotebookVariablesRequestKind2["Named"] = 1] = "Named";
      NotebookVariablesRequestKind2[NotebookVariablesRequestKind2["Indexed"] = 2] = "Indexed";
    })(NotebookVariablesRequestKind || (NotebookVariablesRequestKind = {}));
    $cV = class $cV2 {
      constructor(label, timestamp) {
        this.label = label;
        this.timestamp = timestamp;
      }
    };
    $cV = __decorate([
      es5ClassCompat
    ], $cV);
    (function(ExtensionMode2) {
      ExtensionMode2[ExtensionMode2["Production"] = 1] = "Production";
      ExtensionMode2[ExtensionMode2["Development"] = 2] = "Development";
      ExtensionMode2[ExtensionMode2["Test"] = 3] = "Test";
    })(ExtensionMode || (ExtensionMode = {}));
    (function(ExtensionRuntime2) {
      ExtensionRuntime2[ExtensionRuntime2["Node"] = 1] = "Node";
      ExtensionRuntime2[ExtensionRuntime2["Webworker"] = 2] = "Webworker";
    })(ExtensionRuntime || (ExtensionRuntime = {}));
    (function(StandardTokenType2) {
      StandardTokenType2[StandardTokenType2["Other"] = 0] = "Other";
      StandardTokenType2[StandardTokenType2["Comment"] = 1] = "Comment";
      StandardTokenType2[StandardTokenType2["String"] = 2] = "String";
      StandardTokenType2[StandardTokenType2["RegEx"] = 3] = "RegEx";
    })(StandardTokenType || (StandardTokenType = {}));
    (function(TestResultState3) {
      TestResultState3[TestResultState3["Queued"] = 1] = "Queued";
      TestResultState3[TestResultState3["Running"] = 2] = "Running";
      TestResultState3[TestResultState3["Passed"] = 3] = "Passed";
      TestResultState3[TestResultState3["Failed"] = 4] = "Failed";
      TestResultState3[TestResultState3["Skipped"] = 5] = "Skipped";
      TestResultState3[TestResultState3["Errored"] = 6] = "Errored";
    })(TestResultState || (TestResultState = {}));
    (function(TestRunProfileKind3) {
      TestRunProfileKind3[TestRunProfileKind3["Run"] = 1] = "Run";
      TestRunProfileKind3[TestRunProfileKind3["Debug"] = 2] = "Debug";
      TestRunProfileKind3[TestRunProfileKind3["Coverage"] = 3] = "Coverage";
    })(TestRunProfileKind || (TestRunProfileKind = {}));
    $fV = class {
      constructor(controllerId, profileId, kind) {
        this.controllerId = controllerId;
        this.profileId = profileId;
        this.kind = kind;
      }
    };
    $gV = class $gV2 {
      constructor(include = void 0, exclude = void 0, profile = void 0, continuous = false, preserveFocus = true) {
        this.include = include;
        this.exclude = exclude;
        this.profile = profile;
        this.continuous = continuous;
        this.preserveFocus = preserveFocus;
      }
    };
    $gV = __decorate([
      es5ClassCompat
    ], $gV);
    $hV = $hV_1 = class $hV2 {
      static diff(message, expected, actual) {
        const msg = new $hV_1(message);
        msg.expectedOutput = expected;
        msg.actualOutput = actual;
        return msg;
      }
      constructor(message) {
        this.message = message;
      }
    };
    $hV = $hV_1 = __decorate([
      es5ClassCompat
    ], $hV);
    $iV = class $iV2 {
      constructor(id2) {
        this.id = id2;
      }
    };
    $iV = __decorate([
      es5ClassCompat
    ], $iV);
    $kV = class {
      constructor(covered, total) {
        this.covered = covered;
        this.total = total;
        $lV(this);
      }
    };
    $mV = class _$mV {
      static fromDetails(uri, details) {
        const statements = new $kV(0, 0);
        const branches = new $kV(0, 0);
        const decl = new $kV(0, 0);
        for (const detail of details) {
          if ("branches" in detail) {
            statements.total += 1;
            statements.covered += detail.executed ? 1 : 0;
            for (const branch of detail.branches) {
              branches.total += 1;
              branches.covered += branch.executed ? 1 : 0;
            }
          } else {
            decl.total += 1;
            decl.covered += detail.executed ? 1 : 0;
          }
        }
        const coverage = new _$mV(uri, statements, branches.total > 0 ? branches : void 0, decl.total > 0 ? decl : void 0);
        coverage.detailedCoverage = details;
        return coverage;
      }
      constructor(uri, statementCoverage, branchCoverage, declarationCoverage, includesTests = []) {
        this.uri = uri;
        this.statementCoverage = statementCoverage;
        this.branchCoverage = branchCoverage;
        this.declarationCoverage = declarationCoverage;
        this.includesTests = includesTests;
      }
    };
    $nV = class {
      // back compat until finalization:
      get executionCount() {
        return +this.executed;
      }
      set executionCount(n) {
        this.executed = n;
      }
      constructor(executed, location2, branches = []) {
        this.executed = executed;
        this.location = location2;
        this.branches = branches;
      }
    };
    $oV = class {
      // back compat until finalization:
      get executionCount() {
        return +this.executed;
      }
      set executionCount(n) {
        this.executed = n;
      }
      constructor(executed, location2, label) {
        this.executed = executed;
        this.location = location2;
        this.label = label;
      }
    };
    $pV = class {
      // back compat until finalization:
      get executionCount() {
        return +this.executed;
      }
      set executionCount(n) {
        this.executed = n;
      }
      constructor(name, executed, location2) {
        this.name = name;
        this.executed = executed;
        this.location = location2;
      }
    };
    (function(ExternalUriOpenerPriority3) {
      ExternalUriOpenerPriority3[ExternalUriOpenerPriority3["None"] = 0] = "None";
      ExternalUriOpenerPriority3[ExternalUriOpenerPriority3["Option"] = 1] = "Option";
      ExternalUriOpenerPriority3[ExternalUriOpenerPriority3["Default"] = 2] = "Default";
      ExternalUriOpenerPriority3[ExternalUriOpenerPriority3["Preferred"] = 3] = "Preferred";
    })(ExternalUriOpenerPriority || (ExternalUriOpenerPriority = {}));
    (function(WorkspaceTrustState2) {
      WorkspaceTrustState2[WorkspaceTrustState2["Untrusted"] = 0] = "Untrusted";
      WorkspaceTrustState2[WorkspaceTrustState2["Trusted"] = 1] = "Trusted";
      WorkspaceTrustState2[WorkspaceTrustState2["Unspecified"] = 2] = "Unspecified";
    })(WorkspaceTrustState || (WorkspaceTrustState = {}));
    (function(PortAutoForwardAction2) {
      PortAutoForwardAction2[PortAutoForwardAction2["Notify"] = 1] = "Notify";
      PortAutoForwardAction2[PortAutoForwardAction2["OpenBrowser"] = 2] = "OpenBrowser";
      PortAutoForwardAction2[PortAutoForwardAction2["OpenPreview"] = 3] = "OpenPreview";
      PortAutoForwardAction2[PortAutoForwardAction2["Silent"] = 4] = "Silent";
      PortAutoForwardAction2[PortAutoForwardAction2["Ignore"] = 5] = "Ignore";
      PortAutoForwardAction2[PortAutoForwardAction2["OpenBrowserOnce"] = 6] = "OpenBrowserOnce";
    })(PortAutoForwardAction || (PortAutoForwardAction = {}));
    $qV = class {
      constructor(kind, name, detail, uri, range, selectionRange) {
        this.kind = kind;
        this.name = name;
        this.detail = detail;
        this.uri = uri;
        this.range = range;
        this.selectionRange = selectionRange;
      }
    };
    (function(InteractiveSessionVoteDirection2) {
      InteractiveSessionVoteDirection2[InteractiveSessionVoteDirection2["Down"] = 0] = "Down";
      InteractiveSessionVoteDirection2[InteractiveSessionVoteDirection2["Up"] = 1] = "Up";
    })(InteractiveSessionVoteDirection || (InteractiveSessionVoteDirection = {}));
    (function(ChatCopyKind2) {
      ChatCopyKind2[ChatCopyKind2["Action"] = 1] = "Action";
      ChatCopyKind2[ChatCopyKind2["Toolbar"] = 2] = "Toolbar";
    })(ChatCopyKind || (ChatCopyKind = {}));
    (function(ChatVariableLevel2) {
      ChatVariableLevel2[ChatVariableLevel2["Short"] = 1] = "Short";
      ChatVariableLevel2[ChatVariableLevel2["Medium"] = 2] = "Medium";
      ChatVariableLevel2[ChatVariableLevel2["Full"] = 3] = "Full";
    })(ChatVariableLevel || (ChatVariableLevel = {}));
    (function(ChatEditingSessionActionOutcome2) {
      ChatEditingSessionActionOutcome2[ChatEditingSessionActionOutcome2["Accepted"] = 1] = "Accepted";
      ChatEditingSessionActionOutcome2[ChatEditingSessionActionOutcome2["Rejected"] = 2] = "Rejected";
      ChatEditingSessionActionOutcome2[ChatEditingSessionActionOutcome2["Saved"] = 3] = "Saved";
    })(ChatEditingSessionActionOutcome || (ChatEditingSessionActionOutcome = {}));
    (function(InteractiveEditorResponseFeedbackKind2) {
      InteractiveEditorResponseFeedbackKind2[InteractiveEditorResponseFeedbackKind2["Unhelpful"] = 0] = "Unhelpful";
      InteractiveEditorResponseFeedbackKind2[InteractiveEditorResponseFeedbackKind2["Helpful"] = 1] = "Helpful";
      InteractiveEditorResponseFeedbackKind2[InteractiveEditorResponseFeedbackKind2["Undone"] = 2] = "Undone";
      InteractiveEditorResponseFeedbackKind2[InteractiveEditorResponseFeedbackKind2["Accepted"] = 3] = "Accepted";
      InteractiveEditorResponseFeedbackKind2[InteractiveEditorResponseFeedbackKind2["Bug"] = 4] = "Bug";
    })(InteractiveEditorResponseFeedbackKind || (InteractiveEditorResponseFeedbackKind = {}));
    (function(ChatResultFeedbackKind2) {
      ChatResultFeedbackKind2[ChatResultFeedbackKind2["Unhelpful"] = 0] = "Unhelpful";
      ChatResultFeedbackKind2[ChatResultFeedbackKind2["Helpful"] = 1] = "Helpful";
    })(ChatResultFeedbackKind || (ChatResultFeedbackKind = {}));
    $DV = class {
      constructor(value) {
        if (typeof value !== "string" && value.isTrusted === true) {
          throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");
        }
        this.value = typeof value === "string" ? new $4T(value) : value;
      }
    };
    $EV = class {
      constructor(value, vulnerabilities) {
        if (typeof value !== "string" && value.isTrusted === true) {
          throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");
        }
        this.value = typeof value === "string" ? new $4T(value) : value;
        this.vulnerabilities = vulnerabilities;
      }
    };
    $FV = class {
      constructor(participant, command) {
        this.participant = participant;
        this.command = command;
      }
    };
    $GV = class {
      constructor(title, message, data, buttons) {
        this.title = title;
        this.message = message;
        this.data = data;
        this.buttons = buttons;
      }
    };
    $HV = class {
      constructor(value, baseUri) {
        this.value = value;
        this.baseUri = baseUri;
      }
    };
    $IV = class {
      constructor(value, title) {
        this.value = value;
        this.value2 = value;
        this.title = title;
      }
    };
    $JV = class {
      constructor(value) {
        this.value = value;
      }
    };
    $LV = class {
      constructor(value) {
        if (typeof value !== "string" && value.isTrusted === true) {
          throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");
        }
        this.value = typeof value === "string" ? new $4T(value) : value;
      }
    };
    $MV = class {
      constructor(value) {
        this.value = value;
      }
    };
    $NV = class {
      constructor(value, iconPath, options2) {
        this.value = value;
        this.iconPath = iconPath;
        this.options = options2;
      }
    };
    $OV = class {
      constructor(value) {
        this.value = value;
      }
    };
    $PV = class {
      constructor(value, license, snippet) {
        this.value = value;
        this.license = license;
        this.snippet = snippet;
      }
    };
    $QV = class {
      constructor(uri, range) {
        this.uri = uri;
        this.range = range;
      }
    };
    $RV = class {
      constructor(uri, editsOrDone) {
        this.uri = uri;
        if (editsOrDone === true) {
          this.isDone = true;
          this.edits = [];
        } else {
          this.edits = Array.isArray(editsOrDone) ? editsOrDone : [editsOrDone];
        }
      }
    };
    (function(ChatLocation3) {
      ChatLocation3[ChatLocation3["Panel"] = 1] = "Panel";
      ChatLocation3[ChatLocation3["Terminal"] = 2] = "Terminal";
      ChatLocation3[ChatLocation3["Notebook"] = 3] = "Notebook";
      ChatLocation3[ChatLocation3["Editor"] = 4] = "Editor";
      ChatLocation3[ChatLocation3["EditingSession"] = 5] = "EditingSession";
    })(ChatLocation || (ChatLocation = {}));
    (function(ChatResponseReferencePartStatusKind2) {
      ChatResponseReferencePartStatusKind2[ChatResponseReferencePartStatusKind2["Complete"] = 1] = "Complete";
      ChatResponseReferencePartStatusKind2[ChatResponseReferencePartStatusKind2["Partial"] = 2] = "Partial";
      ChatResponseReferencePartStatusKind2[ChatResponseReferencePartStatusKind2["Omitted"] = 3] = "Omitted";
    })(ChatResponseReferencePartStatusKind || (ChatResponseReferencePartStatusKind = {}));
    $WV = class {
      constructor(mimeType, data) {
        this.mimeType = mimeType;
        this.data = data;
      }
    };
    (function(LanguageModelChatMessageRole3) {
      LanguageModelChatMessageRole3[LanguageModelChatMessageRole3["User"] = 1] = "User";
      LanguageModelChatMessageRole3[LanguageModelChatMessageRole3["Assistant"] = 2] = "Assistant";
      LanguageModelChatMessageRole3[LanguageModelChatMessageRole3["System"] = 3] = "System";
    })(LanguageModelChatMessageRole || (LanguageModelChatMessageRole = {}));
    $XV = class {
      constructor(callId, content, isError) {
        this.callId = callId;
        this.content = content;
        this.isError = isError ?? false;
      }
    };
    $YV = class _$YV {
      static User(content, name) {
        return new _$YV(LanguageModelChatMessageRole.User, content, name);
      }
      static Assistant(content, name) {
        return new _$YV(LanguageModelChatMessageRole.Assistant, content, name);
      }
      set content(value) {
        if (typeof value === "string") {
          this.c = [new $1V(value)];
        } else {
          this.c = value;
        }
      }
      get content() {
        return this.c;
      }
      // Temp to avoid breaking changes
      set content2(value) {
        if (value) {
          this.content = value.map((part) => {
            if (typeof part === "string") {
              return new $1V(part);
            }
            return part;
          });
        }
      }
      get content2() {
        return this.content.map((part) => {
          if (part instanceof $1V) {
            return part.value;
          }
          return part;
        });
      }
      constructor(role, content, name) {
        this.c = [];
        this.role = role;
        this.content = content;
        this.name = name;
      }
    };
    $ZV = class {
      constructor(callId, name, input) {
        this.callId = callId;
        this.name = name;
        this.input = input;
      }
    };
    $1V = class {
      constructor(value) {
        this.value = value;
      }
      toJSON() {
        return {
          $mid: 21,
          value: this.value
        };
      }
    };
    $2V = class {
      constructor(value) {
        this.value = value;
      }
      toJSON() {
        return {
          $mid: 22,
          value: this.value
        };
      }
    };
    $7V = class {
      constructor(content) {
        this.content = content;
      }
      toJSON() {
        return {
          $mid: 20,
          content: this.content
        };
      }
    };
    (function(LanguageModelChatToolMode2) {
      LanguageModelChatToolMode2[LanguageModelChatToolMode2["Auto"] = 1] = "Auto";
      LanguageModelChatToolMode2[LanguageModelChatToolMode2["Required"] = 2] = "Required";
    })(LanguageModelChatToolMode || (LanguageModelChatToolMode = {}));
    (function(RelatedInformationType2) {
      RelatedInformationType2[RelatedInformationType2["SymbolInformation"] = 1] = "SymbolInformation";
      RelatedInformationType2[RelatedInformationType2["CommandInformation"] = 2] = "CommandInformation";
      RelatedInformationType2[RelatedInformationType2["SearchInformation"] = 3] = "SearchInformation";
      RelatedInformationType2[RelatedInformationType2["SettingInformation"] = 4] = "SettingInformation";
    })(RelatedInformationType || (RelatedInformationType = {}));
    (function(SpeechToTextStatus2) {
      SpeechToTextStatus2[SpeechToTextStatus2["Started"] = 1] = "Started";
      SpeechToTextStatus2[SpeechToTextStatus2["Recognizing"] = 2] = "Recognizing";
      SpeechToTextStatus2[SpeechToTextStatus2["Recognized"] = 3] = "Recognized";
      SpeechToTextStatus2[SpeechToTextStatus2["Stopped"] = 4] = "Stopped";
      SpeechToTextStatus2[SpeechToTextStatus2["Error"] = 5] = "Error";
    })(SpeechToTextStatus || (SpeechToTextStatus = {}));
    (function(TextToSpeechStatus2) {
      TextToSpeechStatus2[TextToSpeechStatus2["Started"] = 1] = "Started";
      TextToSpeechStatus2[TextToSpeechStatus2["Stopped"] = 2] = "Stopped";
      TextToSpeechStatus2[TextToSpeechStatus2["Error"] = 3] = "Error";
    })(TextToSpeechStatus || (TextToSpeechStatus = {}));
    (function(KeywordRecognitionStatus2) {
      KeywordRecognitionStatus2[KeywordRecognitionStatus2["Recognized"] = 1] = "Recognized";
      KeywordRecognitionStatus2[KeywordRecognitionStatus2["Stopped"] = 2] = "Stopped";
    })(KeywordRecognitionStatus || (KeywordRecognitionStatus = {}));
    (function(InlineEditTriggerKind3) {
      InlineEditTriggerKind3[InlineEditTriggerKind3["Invoke"] = 0] = "Invoke";
      InlineEditTriggerKind3[InlineEditTriggerKind3["Automatic"] = 1] = "Automatic";
    })(InlineEditTriggerKind || (InlineEditTriggerKind = {}));
  }
});

// out-build/vs/base/common/dataTransfer.js
var $nE;
var init_dataTransfer = __esm({
  "out-build/vs/base/common/dataTransfer.js"() {
    "use strict";
    init_arrays();
    init_iterator();
    init_uuid();
    $nE = Object.freeze({
      // http://amundsen.com/hypermedia/urilist/
      create: (entries) => {
        return $Rb(entries.map((x) => x.toString())).join("\r\n");
      },
      split: (str) => {
        return str.split("\r\n");
      },
      parse: (str) => {
        return $nE.split(str).filter((value) => !value.startsWith("#"));
      }
    });
  }
});

// out-build/vs/base/common/marked/marked.js
function _getDefaults() {
  return {
    async: false,
    breaks: false,
    extensions: null,
    gfm: true,
    hooks: null,
    pedantic: false,
    renderer: null,
    silent: false,
    tokenizer: null,
    walkTokens: null
  };
}
function changeDefaults(newDefaults) {
  _defaults = newDefaults;
}
function escape$1(html2, encode) {
  if (encode) {
    if (escapeTest.test(html2)) {
      return html2.replace(escapeReplace, getEscapeReplacement);
    }
  } else {
    if (escapeTestNoEncode.test(html2)) {
      return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
    }
  }
  return html2;
}
function edit(regex, opt) {
  let source = typeof regex === "string" ? regex : regex.source;
  opt = opt || "";
  const obj = {
    replace: (name, val) => {
      let valSource = typeof val === "string" ? val : val.source;
      valSource = valSource.replace(caret, "$1");
      source = source.replace(name, valSource);
      return obj;
    },
    getRegex: () => {
      return new RegExp(source, opt);
    }
  };
  return obj;
}
function cleanUrl(href) {
  try {
    href = encodeURI(href).replace(/%25/g, "%");
  } catch {
    return null;
  }
  return href;
}
function splitCells(tableRow, count) {
  const row = tableRow.replace(/\|/g, (match, offset, str) => {
    let escaped = false;
    let curr = offset;
    while (--curr >= 0 && str[curr] === "\\")
      escaped = !escaped;
    if (escaped) {
      return "|";
    } else {
      return " |";
    }
  }), cells = row.split(/ \|/);
  let i = 0;
  if (!cells[0].trim()) {
    cells.shift();
  }
  if (cells.length > 0 && !cells[cells.length - 1].trim()) {
    cells.pop();
  }
  if (count) {
    if (cells.length > count) {
      cells.splice(count);
    } else {
      while (cells.length < count)
        cells.push("");
    }
  }
  for (; i < cells.length; i++) {
    cells[i] = cells[i].trim().replace(/\\\|/g, "|");
  }
  return cells;
}
function rtrim(str, c, invert) {
  const l = str.length;
  if (l === 0) {
    return "";
  }
  let suffLen = 0;
  while (suffLen < l) {
    const currChar = str.charAt(l - suffLen - 1);
    if (currChar === c && !invert) {
      suffLen++;
    } else if (currChar !== c && invert) {
      suffLen++;
    } else {
      break;
    }
  }
  return str.slice(0, l - suffLen);
}
function findClosingBracket(str, b) {
  if (str.indexOf(b[1]) === -1) {
    return -1;
  }
  let level = 0;
  for (let i = 0; i < str.length; i++) {
    if (str[i] === "\\") {
      i++;
    } else if (str[i] === b[0]) {
      level++;
    } else if (str[i] === b[1]) {
      level--;
      if (level < 0) {
        return i;
      }
    }
  }
  return -1;
}
function outputLink(cap, link2, raw, lexer2) {
  const href = link2.href;
  const title = link2.title ? escape$1(link2.title) : null;
  const text = cap[1].replace(/\\([\[\]])/g, "$1");
  if (cap[0].charAt(0) !== "!") {
    lexer2.state.inLink = true;
    const token = {
      type: "link",
      raw,
      href,
      title,
      text,
      tokens: lexer2.inlineTokens(text)
    };
    lexer2.state.inLink = false;
    return token;
  }
  return {
    type: "image",
    raw,
    href,
    title,
    text: escape$1(text)
  };
}
function indentCodeCompensation(raw, text) {
  const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
  if (matchIndentToCode === null) {
    return text;
  }
  const indentToCode = matchIndentToCode[1];
  return text.split("\n").map((node) => {
    const matchIndentInNode = node.match(/^\s+/);
    if (matchIndentInNode === null) {
      return node;
    }
    const [indentInNode] = matchIndentInNode;
    if (indentInNode.length >= indentToCode.length) {
      return node.slice(indentToCode.length);
    }
    return node;
  }).join("\n");
}
function marked(src, opt) {
  return markedInstance.parse(src, opt);
}
var _defaults, escapeTest, escapeReplace, escapeTestNoEncode, escapeReplaceNoEncode, escapeReplacements, getEscapeReplacement, caret, noopTest, _Tokenizer, newline, blockCode, fences, hr, heading, bullet, lheading, _paragraph, blockText, _blockLabel, def, list, _tag, _comment, html, paragraph, blockquote, blockNormal, gfmTable, blockGfm, blockPedantic, escape, inlineCode, br, inlineText, _punctuation, punctuation, blockSkip, emStrongLDelim, emStrongRDelimAst, emStrongRDelimUnd, anyPunctuation, autolink, _inlineComment, tag, _inlineLabel, link, reflink, nolink, reflinkSearch, inlineNormal, inlinePedantic, inlineGfm, inlineBreaks, block, inline, _Lexer, _Renderer, _TextRenderer, _Parser, _Hooks, Marked, markedInstance, options, setOptions, use, walkTokens, parseInline, parser, lexer;
var init_marked = __esm({
  "out-build/vs/base/common/marked/marked.js"() {
    "use strict";
    _defaults = _getDefaults();
    escapeTest = /[&<>"']/;
    escapeReplace = new RegExp(escapeTest.source, "g");
    escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
    escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g");
    escapeReplacements = {
      "&": "&amp;",
      "<": "&lt;",
      ">": "&gt;",
      '"': "&quot;",
      "'": "&#39;"
    };
    getEscapeReplacement = (ch) => escapeReplacements[ch];
    caret = /(^|[^\[])\^/g;
    noopTest = { exec: () => null };
    _Tokenizer = class {
      options;
      rules;
      // set by the lexer
      lexer;
      // set by the lexer
      constructor(options2) {
        this.options = options2 || _defaults;
      }
      space(src) {
        const cap = this.rules.block.newline.exec(src);
        if (cap && cap[0].length > 0) {
          return {
            type: "space",
            raw: cap[0]
          };
        }
      }
      code(src) {
        const cap = this.rules.block.code.exec(src);
        if (cap) {
          const text = cap[0].replace(/^ {1,4}/gm, "");
          return {
            type: "code",
            raw: cap[0],
            codeBlockStyle: "indented",
            text: !this.options.pedantic ? rtrim(text, "\n") : text
          };
        }
      }
      fences(src) {
        const cap = this.rules.block.fences.exec(src);
        if (cap) {
          const raw = cap[0];
          const text = indentCodeCompensation(raw, cap[3] || "");
          return {
            type: "code",
            raw,
            lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
            text
          };
        }
      }
      heading(src) {
        const cap = this.rules.block.heading.exec(src);
        if (cap) {
          let text = cap[2].trim();
          if (/#$/.test(text)) {
            const trimmed = rtrim(text, "#");
            if (this.options.pedantic) {
              text = trimmed.trim();
            } else if (!trimmed || / $/.test(trimmed)) {
              text = trimmed.trim();
            }
          }
          return {
            type: "heading",
            raw: cap[0],
            depth: cap[1].length,
            text,
            tokens: this.lexer.inline(text)
          };
        }
      }
      hr(src) {
        const cap = this.rules.block.hr.exec(src);
        if (cap) {
          return {
            type: "hr",
            raw: rtrim(cap[0], "\n")
          };
        }
      }
      blockquote(src) {
        const cap = this.rules.block.blockquote.exec(src);
        if (cap) {
          let lines = rtrim(cap[0], "\n").split("\n");
          let raw = "";
          let text = "";
          const tokens = [];
          while (lines.length > 0) {
            let inBlockquote = false;
            const currentLines = [];
            let i;
            for (i = 0; i < lines.length; i++) {
              if (/^ {0,3}>/.test(lines[i])) {
                currentLines.push(lines[i]);
                inBlockquote = true;
              } else if (!inBlockquote) {
                currentLines.push(lines[i]);
              } else {
                break;
              }
            }
            lines = lines.slice(i);
            const currentRaw = currentLines.join("\n");
            const currentText = currentRaw.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, "\n    $1").replace(/^ {0,3}>[ \t]?/gm, "");
            raw = raw ? `${raw}
${currentRaw}` : currentRaw;
            text = text ? `${text}
${currentText}` : currentText;
            const top = this.lexer.state.top;
            this.lexer.state.top = true;
            this.lexer.blockTokens(currentText, tokens, true);
            this.lexer.state.top = top;
            if (lines.length === 0) {
              break;
            }
            const lastToken = tokens[tokens.length - 1];
            if (lastToken?.type === "code") {
              break;
            } else if (lastToken?.type === "blockquote") {
              const oldToken = lastToken;
              const newText = oldToken.raw + "\n" + lines.join("\n");
              const newToken = this.blockquote(newText);
              tokens[tokens.length - 1] = newToken;
              raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
              text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
              break;
            } else if (lastToken?.type === "list") {
              const oldToken = lastToken;
              const newText = oldToken.raw + "\n" + lines.join("\n");
              const newToken = this.list(newText);
              tokens[tokens.length - 1] = newToken;
              raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
              text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
              lines = newText.substring(tokens[tokens.length - 1].raw.length).split("\n");
              continue;
            }
          }
          return {
            type: "blockquote",
            raw,
            tokens,
            text
          };
        }
      }
      list(src) {
        let cap = this.rules.block.list.exec(src);
        if (cap) {
          let bull = cap[1].trim();
          const isordered = bull.length > 1;
          const list2 = {
            type: "list",
            raw: "",
            ordered: isordered,
            start: isordered ? +bull.slice(0, -1) : "",
            loose: false,
            items: []
          };
          bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
          if (this.options.pedantic) {
            bull = isordered ? bull : "[*+-]";
          }
          const itemRegex = new RegExp(`^( {0,3}${bull})((?:[	 ][^\\n]*)?(?:\\n|$))`);
          let endsWithBlankLine = false;
          while (src) {
            let endEarly = false;
            let raw = "";
            let itemContents = "";
            if (!(cap = itemRegex.exec(src))) {
              break;
            }
            if (this.rules.block.hr.test(src)) {
              break;
            }
            raw = cap[0];
            src = src.substring(raw.length);
            let line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t) => " ".repeat(3 * t.length));
            let nextLine = src.split("\n", 1)[0];
            let blankLine = !line.trim();
            let indent2 = 0;
            if (this.options.pedantic) {
              indent2 = 2;
              itemContents = line.trimStart();
            } else if (blankLine) {
              indent2 = cap[1].length + 1;
            } else {
              indent2 = cap[2].search(/[^ ]/);
              indent2 = indent2 > 4 ? 1 : indent2;
              itemContents = line.slice(indent2);
              indent2 += cap[1].length;
            }
            if (blankLine && /^ *$/.test(nextLine)) {
              raw += nextLine + "\n";
              src = src.substring(nextLine.length + 1);
              endEarly = true;
            }
            if (!endEarly) {
              const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`);
              const hrRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
              const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:\`\`\`|~~~)`);
              const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}#`);
              while (src) {
                const rawLine = src.split("\n", 1)[0];
                nextLine = rawLine;
                if (this.options.pedantic) {
                  nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ");
                }
                if (fencesBeginRegex.test(nextLine)) {
                  break;
                }
                if (headingBeginRegex.test(nextLine)) {
                  break;
                }
                if (nextBulletRegex.test(nextLine)) {
                  break;
                }
                if (hrRegex.test(src)) {
                  break;
                }
                if (nextLine.search(/[^ ]/) >= indent2 || !nextLine.trim()) {
                  itemContents += "\n" + nextLine.slice(indent2);
                } else {
                  if (blankLine) {
                    break;
                  }
                  if (line.search(/[^ ]/) >= 4) {
                    break;
                  }
                  if (fencesBeginRegex.test(line)) {
                    break;
                  }
                  if (headingBeginRegex.test(line)) {
                    break;
                  }
                  if (hrRegex.test(line)) {
                    break;
                  }
                  itemContents += "\n" + nextLine;
                }
                if (!blankLine && !nextLine.trim()) {
                  blankLine = true;
                }
                raw += rawLine + "\n";
                src = src.substring(rawLine.length + 1);
                line = nextLine.slice(indent2);
              }
            }
            if (!list2.loose) {
              if (endsWithBlankLine) {
                list2.loose = true;
              } else if (/\n *\n *$/.test(raw)) {
                endsWithBlankLine = true;
              }
            }
            let istask = null;
            let ischecked;
            if (this.options.gfm) {
              istask = /^\[[ xX]\] /.exec(itemContents);
              if (istask) {
                ischecked = istask[0] !== "[ ] ";
                itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
              }
            }
            list2.items.push({
              type: "list_item",
              raw,
              task: !!istask,
              checked: ischecked,
              loose: false,
              text: itemContents,
              tokens: []
            });
            list2.raw += raw;
          }
          list2.items[list2.items.length - 1].raw = list2.items[list2.items.length - 1].raw.trimEnd();
          list2.items[list2.items.length - 1].text = list2.items[list2.items.length - 1].text.trimEnd();
          list2.raw = list2.raw.trimEnd();
          for (let i = 0; i < list2.items.length; i++) {
            this.lexer.state.top = false;
            list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []);
            if (!list2.loose) {
              const spacers = list2.items[i].tokens.filter((t) => t.type === "space");
              const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t) => /\n.*\n/.test(t.raw));
              list2.loose = hasMultipleLineBreaks;
            }
          }
          if (list2.loose) {
            for (let i = 0; i < list2.items.length; i++) {
              list2.items[i].loose = true;
            }
          }
          return list2;
        }
      }
      html(src) {
        const cap = this.rules.block.html.exec(src);
        if (cap) {
          const token = {
            type: "html",
            block: true,
            raw: cap[0],
            pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
            text: cap[0]
          };
          return token;
        }
      }
      def(src) {
        const cap = this.rules.block.def.exec(src);
        if (cap) {
          const tag2 = cap[1].toLowerCase().replace(/\s+/g, " ");
          const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
          const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
          return {
            type: "def",
            tag: tag2,
            raw: cap[0],
            href,
            title
          };
        }
      }
      table(src) {
        const cap = this.rules.block.table.exec(src);
        if (!cap) {
          return;
        }
        if (!/[:|]/.test(cap[2])) {
          return;
        }
        const headers = splitCells(cap[1]);
        const aligns = cap[2].replace(/^\||\| *$/g, "").split("|");
        const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : [];
        const item = {
          type: "table",
          raw: cap[0],
          header: [],
          align: [],
          rows: []
        };
        if (headers.length !== aligns.length) {
          return;
        }
        for (const align of aligns) {
          if (/^ *-+: *$/.test(align)) {
            item.align.push("right");
          } else if (/^ *:-+: *$/.test(align)) {
            item.align.push("center");
          } else if (/^ *:-+ *$/.test(align)) {
            item.align.push("left");
          } else {
            item.align.push(null);
          }
        }
        for (let i = 0; i < headers.length; i++) {
          item.header.push({
            text: headers[i],
            tokens: this.lexer.inline(headers[i]),
            header: true,
            align: item.align[i]
          });
        }
        for (const row of rows) {
          item.rows.push(splitCells(row, item.header.length).map((cell, i) => {
            return {
              text: cell,
              tokens: this.lexer.inline(cell),
              header: false,
              align: item.align[i]
            };
          }));
        }
        return item;
      }
      lheading(src) {
        const cap = this.rules.block.lheading.exec(src);
        if (cap) {
          return {
            type: "heading",
            raw: cap[0],
            depth: cap[2].charAt(0) === "=" ? 1 : 2,
            text: cap[1],
            tokens: this.lexer.inline(cap[1])
          };
        }
      }
      paragraph(src) {
        const cap = this.rules.block.paragraph.exec(src);
        if (cap) {
          const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
          return {
            type: "paragraph",
            raw: cap[0],
            text,
            tokens: this.lexer.inline(text)
          };
        }
      }
      text(src) {
        const cap = this.rules.block.text.exec(src);
        if (cap) {
          return {
            type: "text",
            raw: cap[0],
            text: cap[0],
            tokens: this.lexer.inline(cap[0])
          };
        }
      }
      escape(src) {
        const cap = this.rules.inline.escape.exec(src);
        if (cap) {
          return {
            type: "escape",
            raw: cap[0],
            text: escape$1(cap[1])
          };
        }
      }
      tag(src) {
        const cap = this.rules.inline.tag.exec(src);
        if (cap) {
          if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
            this.lexer.state.inLink = true;
          } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
            this.lexer.state.inLink = false;
          }
          if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
            this.lexer.state.inRawBlock = true;
          } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
            this.lexer.state.inRawBlock = false;
          }
          return {
            type: "html",
            raw: cap[0],
            inLink: this.lexer.state.inLink,
            inRawBlock: this.lexer.state.inRawBlock,
            block: false,
            text: cap[0]
          };
        }
      }
      link(src) {
        const cap = this.rules.inline.link.exec(src);
        if (cap) {
          const trimmedUrl = cap[2].trim();
          if (!this.options.pedantic && /^</.test(trimmedUrl)) {
            if (!/>$/.test(trimmedUrl)) {
              return;
            }
            const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
            if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
              return;
            }
          } else {
            const lastParenIndex = findClosingBracket(cap[2], "()");
            if (lastParenIndex > -1) {
              const start = cap[0].indexOf("!") === 0 ? 5 : 4;
              const linkLen = start + cap[1].length + lastParenIndex;
              cap[2] = cap[2].substring(0, lastParenIndex);
              cap[0] = cap[0].substring(0, linkLen).trim();
              cap[3] = "";
            }
          }
          let href = cap[2];
          let title = "";
          if (this.options.pedantic) {
            const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
            if (link2) {
              href = link2[1];
              title = link2[3];
            }
          } else {
            title = cap[3] ? cap[3].slice(1, -1) : "";
          }
          href = href.trim();
          if (/^</.test(href)) {
            if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
              href = href.slice(1);
            } else {
              href = href.slice(1, -1);
            }
          }
          return outputLink(cap, {
            href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
            title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
          }, cap[0], this.lexer);
        }
      }
      reflink(src, links) {
        let cap;
        if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
          const linkString = (cap[2] || cap[1]).replace(/\s+/g, " ");
          const link2 = links[linkString.toLowerCase()];
          if (!link2) {
            const text = cap[0].charAt(0);
            return {
              type: "text",
              raw: text,
              text
            };
          }
          return outputLink(cap, link2, cap[0], this.lexer);
        }
      }
      emStrong(src, maskedSrc, prevChar = "") {
        let match = this.rules.inline.emStrongLDelim.exec(src);
        if (!match)
          return;
        if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
          return;
        const nextChar = match[1] || match[2] || "";
        if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
          const lLength = [...match[0]].length - 1;
          let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
          const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
          endReg.lastIndex = 0;
          maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
          while ((match = endReg.exec(maskedSrc)) != null) {
            rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
            if (!rDelim)
              continue;
            rLength = [...rDelim].length;
            if (match[3] || match[4]) {
              delimTotal += rLength;
              continue;
            } else if (match[5] || match[6]) {
              if (lLength % 3 && !((lLength + rLength) % 3)) {
                midDelimTotal += rLength;
                continue;
              }
            }
            delimTotal -= rLength;
            if (delimTotal > 0)
              continue;
            rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
            const lastCharLength = [...match[0]][0].length;
            const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
            if (Math.min(lLength, rLength) % 2) {
              const text2 = raw.slice(1, -1);
              return {
                type: "em",
                raw,
                text: text2,
                tokens: this.lexer.inlineTokens(text2)
              };
            }
            const text = raw.slice(2, -2);
            return {
              type: "strong",
              raw,
              text,
              tokens: this.lexer.inlineTokens(text)
            };
          }
        }
      }
      codespan(src) {
        const cap = this.rules.inline.code.exec(src);
        if (cap) {
          let text = cap[2].replace(/\n/g, " ");
          const hasNonSpaceChars = /[^ ]/.test(text);
          const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
          if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
            text = text.substring(1, text.length - 1);
          }
          text = escape$1(text, true);
          return {
            type: "codespan",
            raw: cap[0],
            text
          };
        }
      }
      br(src) {
        const cap = this.rules.inline.br.exec(src);
        if (cap) {
          return {
            type: "br",
            raw: cap[0]
          };
        }
      }
      del(src) {
        const cap = this.rules.inline.del.exec(src);
        if (cap) {
          return {
            type: "del",
            raw: cap[0],
            text: cap[2],
            tokens: this.lexer.inlineTokens(cap[2])
          };
        }
      }
      autolink(src) {
        const cap = this.rules.inline.autolink.exec(src);
        if (cap) {
          let text, href;
          if (cap[2] === "@") {
            text = escape$1(cap[1]);
            href = "mailto:" + text;
          } else {
            text = escape$1(cap[1]);
            href = text;
          }
          return {
            type: "link",
            raw: cap[0],
            text,
            href,
            tokens: [
              {
                type: "text",
                raw: text,
                text
              }
            ]
          };
        }
      }
      url(src) {
        let cap;
        if (cap = this.rules.inline.url.exec(src)) {
          let text, href;
          if (cap[2] === "@") {
            text = escape$1(cap[0]);
            href = "mailto:" + text;
          } else {
            let prevCapZero;
            do {
              prevCapZero = cap[0];
              cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
            } while (prevCapZero !== cap[0]);
            text = escape$1(cap[0]);
            if (cap[1] === "www.") {
              href = "http://" + cap[0];
            } else {
              href = cap[0];
            }
          }
          return {
            type: "link",
            raw: cap[0],
            text,
            href,
            tokens: [
              {
                type: "text",
                raw: text,
                text
              }
            ]
          };
        }
      }
      inlineText(src) {
        const cap = this.rules.inline.text.exec(src);
        if (cap) {
          let text;
          if (this.lexer.state.inRawBlock) {
            text = cap[0];
          } else {
            text = escape$1(cap[0]);
          }
          return {
            type: "text",
            raw: cap[0],
            text
          };
        }
      }
    };
    newline = /^(?: *(?:\n|$))+/;
    blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;
    fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
    hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
    heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
    bullet = /(?:[*+-]|\d{1,9}[.)])/;
    lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).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();
    _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
    blockText = /^[^\n]+/;
    _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
    def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
    list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
    _tag = "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";
    _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
    html = edit("^ {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", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
    paragraph = edit(_paragraph).replace("hr", hr).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", _tag).getRegex();
    blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
    blockNormal = {
      blockquote,
      code: blockCode,
      def,
      fences,
      heading,
      hr,
      html,
      lheading,
      list,
      newline,
      paragraph,
      table: noopTest,
      text: blockText
    };
    gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).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", _tag).getRegex();
    blockGfm = {
      ...blockNormal,
      table: gfmTable,
      paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).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", _tag).getRegex()
    };
    blockPedantic = {
      ...blockNormal,
      html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", _comment).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: noopTest,
      // fences not supported
      lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
      paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
    };
    escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
    inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
    br = /^( {2,}|\\)\n(?!\s*$)/;
    inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
    _punctuation = "\\p{P}\\p{S}";
    punctuation = edit(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, _punctuation).getRegex();
    blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
    emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, _punctuation).getRegex();
    emStrongRDelimAst = edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, _punctuation).getRegex();
    emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, _punctuation).getRegex();
    anyPunctuation = edit(/\\([punct])/, "gu").replace(/punct/g, _punctuation).getRegex();
    autolink = edit(/^<(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();
    _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
    tag = edit("^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", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
    _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
    link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
    reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
    nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
    reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
    inlineNormal = {
      _backpedal: noopTest,
      // only used for GFM url
      anyPunctuation,
      autolink,
      blockSkip,
      br,
      code: inlineCode,
      del: noopTest,
      emStrongLDelim,
      emStrongRDelimAst,
      emStrongRDelimUnd,
      escape,
      link,
      nolink,
      punctuation,
      reflink,
      reflinkSearch,
      tag,
      text: inlineText,
      url: noopTest
    };
    inlinePedantic = {
      ...inlineNormal,
      link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
      reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
    };
    inlineGfm = {
      ...inlineNormal,
      escape: edit(escape).replace("])", "~|])").getRegex(),
      url: edit(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/
    };
    inlineBreaks = {
      ...inlineGfm,
      br: edit(br).replace("{2,}", "*").getRegex(),
      text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
    };
    block = {
      normal: blockNormal,
      gfm: blockGfm,
      pedantic: blockPedantic
    };
    inline = {
      normal: inlineNormal,
      gfm: inlineGfm,
      breaks: inlineBreaks,
      pedantic: inlinePedantic
    };
    _Lexer = class __Lexer {
      tokens;
      options;
      state;
      tokenizer;
      inlineQueue;
      constructor(options2) {
        this.tokens = [];
        this.tokens.links = /* @__PURE__ */ Object.create(null);
        this.options = options2 || _defaults;
        this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
        this.tokenizer = this.options.tokenizer;
        this.tokenizer.options = this.options;
        this.tokenizer.lexer = this;
        this.inlineQueue = [];
        this.state = {
          inLink: false,
          inRawBlock: false,
          top: true
        };
        const rules = {
          block: block.normal,
          inline: inline.normal
        };
        if (this.options.pedantic) {
          rules.block = block.pedantic;
          rules.inline = inline.pedantic;
        } else if (this.options.gfm) {
          rules.block = block.gfm;
          if (this.options.breaks) {
            rules.inline = inline.breaks;
          } else {
            rules.inline = inline.gfm;
          }
        }
        this.tokenizer.rules = rules;
      }
      /**
       * Expose Rules
       */
      static get rules() {
        return {
          block,
          inline
        };
      }
      /**
       * Static Lex Method
       */
      static lex(src, options2) {
        const lexer2 = new __Lexer(options2);
        return lexer2.lex(src);
      }
      /**
       * Static Lex Inline Method
       */
      static lexInline(src, options2) {
        const lexer2 = new __Lexer(options2);
        return lexer2.inlineTokens(src);
      }
      /**
       * Preprocessing
       */
      lex(src) {
        src = src.replace(/\r\n|\r/g, "\n");
        this.blockTokens(src, this.tokens);
        for (let i = 0; i < this.inlineQueue.length; i++) {
          const next = this.inlineQueue[i];
          this.inlineTokens(next.src, next.tokens);
        }
        this.inlineQueue = [];
        return this.tokens;
      }
      blockTokens(src, tokens = [], lastParagraphClipped = false) {
        if (this.options.pedantic) {
          src = src.replace(/\t/g, "    ").replace(/^ +$/gm, "");
        } else {
          src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
            return leading + "    ".repeat(tabs.length);
          });
        }
        let token;
        let lastToken;
        let cutSrc;
        while (src) {
          if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
            if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
              src = src.substring(token.raw.length);
              tokens.push(token);
              return true;
            }
            return false;
          })) {
            continue;
          }
          if (token = this.tokenizer.space(src)) {
            src = src.substring(token.raw.length);
            if (token.raw.length === 1 && tokens.length > 0) {
              tokens[tokens.length - 1].raw += "\n";
            } else {
              tokens.push(token);
            }
            continue;
          }
          if (token = this.tokenizer.code(src)) {
            src = src.substring(token.raw.length);
            lastToken = tokens[tokens.length - 1];
            if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
              lastToken.raw += "\n" + token.raw;
              lastToken.text += "\n" + token.text;
              this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
            } else {
              tokens.push(token);
            }
            continue;
          }
          if (token = this.tokenizer.fences(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.heading(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.hr(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.blockquote(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.list(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.html(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.def(src)) {
            src = src.substring(token.raw.length);
            lastToken = tokens[tokens.length - 1];
            if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
              lastToken.raw += "\n" + token.raw;
              lastToken.text += "\n" + token.raw;
              this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
            } else if (!this.tokens.links[token.tag]) {
              this.tokens.links[token.tag] = {
                href: token.href,
                title: token.title
              };
            }
            continue;
          }
          if (token = this.tokenizer.table(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.lheading(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          cutSrc = src;
          if (this.options.extensions && this.options.extensions.startBlock) {
            let startIndex = Infinity;
            const tempSrc = src.slice(1);
            let tempStart;
            this.options.extensions.startBlock.forEach((getStartIndex) => {
              tempStart = getStartIndex.call({ lexer: this }, tempSrc);
              if (typeof tempStart === "number" && tempStart >= 0) {
                startIndex = Math.min(startIndex, tempStart);
              }
            });
            if (startIndex < Infinity && startIndex >= 0) {
              cutSrc = src.substring(0, startIndex + 1);
            }
          }
          if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
            lastToken = tokens[tokens.length - 1];
            if (lastParagraphClipped && lastToken?.type === "paragraph") {
              lastToken.raw += "\n" + token.raw;
              lastToken.text += "\n" + token.text;
              this.inlineQueue.pop();
              this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
            } else {
              tokens.push(token);
            }
            lastParagraphClipped = cutSrc.length !== src.length;
            src = src.substring(token.raw.length);
            continue;
          }
          if (token = this.tokenizer.text(src)) {
            src = src.substring(token.raw.length);
            lastToken = tokens[tokens.length - 1];
            if (lastToken && lastToken.type === "text") {
              lastToken.raw += "\n" + token.raw;
              lastToken.text += "\n" + token.text;
              this.inlineQueue.pop();
              this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
            } else {
              tokens.push(token);
            }
            continue;
          }
          if (src) {
            const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
            if (this.options.silent) {
              console.error(errMsg);
              break;
            } else {
              throw new Error(errMsg);
            }
          }
        }
        this.state.top = true;
        return tokens;
      }
      inline(src, tokens = []) {
        this.inlineQueue.push({ src, tokens });
        return tokens;
      }
      /**
       * Lexing/Compiling
       */
      inlineTokens(src, tokens = []) {
        let token, lastToken, cutSrc;
        let maskedSrc = src;
        let match;
        let keepPrevChar, prevChar;
        if (this.tokens.links) {
          const links = Object.keys(this.tokens.links);
          if (links.length > 0) {
            while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
              if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
                maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
              }
            }
          }
        }
        while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
          maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
        }
        while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
          maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
        }
        while (src) {
          if (!keepPrevChar) {
            prevChar = "";
          }
          keepPrevChar = false;
          if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
            if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
              src = src.substring(token.raw.length);
              tokens.push(token);
              return true;
            }
            return false;
          })) {
            continue;
          }
          if (token = this.tokenizer.escape(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.tag(src)) {
            src = src.substring(token.raw.length);
            lastToken = tokens[tokens.length - 1];
            if (lastToken && token.type === "text" && lastToken.type === "text") {
              lastToken.raw += token.raw;
              lastToken.text += token.text;
            } else {
              tokens.push(token);
            }
            continue;
          }
          if (token = this.tokenizer.link(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.reflink(src, this.tokens.links)) {
            src = src.substring(token.raw.length);
            lastToken = tokens[tokens.length - 1];
            if (lastToken && token.type === "text" && lastToken.type === "text") {
              lastToken.raw += token.raw;
              lastToken.text += token.text;
            } else {
              tokens.push(token);
            }
            continue;
          }
          if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.codespan(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.br(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.del(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (token = this.tokenizer.autolink(src)) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          if (!this.state.inLink && (token = this.tokenizer.url(src))) {
            src = src.substring(token.raw.length);
            tokens.push(token);
            continue;
          }
          cutSrc = src;
          if (this.options.extensions && this.options.extensions.startInline) {
            let startIndex = Infinity;
            const tempSrc = src.slice(1);
            let tempStart;
            this.options.extensions.startInline.forEach((getStartIndex) => {
              tempStart = getStartIndex.call({ lexer: this }, tempSrc);
              if (typeof tempStart === "number" && tempStart >= 0) {
                startIndex = Math.min(startIndex, tempStart);
              }
            });
            if (startIndex < Infinity && startIndex >= 0) {
              cutSrc = src.substring(0, startIndex + 1);
            }
          }
          if (token = this.tokenizer.inlineText(cutSrc)) {
            src = src.substring(token.raw.length);
            if (token.raw.slice(-1) !== "_") {
              prevChar = token.raw.slice(-1);
            }
            keepPrevChar = true;
            lastToken = tokens[tokens.length - 1];
            if (lastToken && lastToken.type === "text") {
              lastToken.raw += token.raw;
              lastToken.text += token.text;
            } else {
              tokens.push(token);
            }
            continue;
          }
          if (src) {
            const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
            if (this.options.silent) {
              console.error(errMsg);
              break;
            } else {
              throw new Error(errMsg);
            }
          }
        }
        return tokens;
      }
    };
    _Renderer = class {
      options;
      parser;
      // set by the parser
      constructor(options2) {
        this.options = options2 || _defaults;
      }
      space(token) {
        return "";
      }
      code({ text, lang, escaped }) {
        const langString = (lang || "").match(/^\S*/)?.[0];
        const code = text.replace(/\n$/, "") + "\n";
        if (!langString) {
          return "<pre><code>" + (escaped ? code : escape$1(code, true)) + "</code></pre>\n";
        }
        return '<pre><code class="language-' + escape$1(langString) + '">' + (escaped ? code : escape$1(code, true)) + "</code></pre>\n";
      }
      blockquote({ tokens }) {
        const body = this.parser.parse(tokens);
        return `<blockquote>
${body}</blockquote>
`;
      }
      html({ text }) {
        return text;
      }
      heading({ tokens, depth }) {
        return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
`;
      }
      hr(token) {
        return "<hr>\n";
      }
      list(token) {
        const ordered = token.ordered;
        const start = token.start;
        let body = "";
        for (let j = 0; j < token.items.length; j++) {
          const item = token.items[j];
          body += this.listitem(item);
        }
        const type2 = ordered ? "ol" : "ul";
        const startAttr = ordered && start !== 1 ? ' start="' + start + '"' : "";
        return "<" + type2 + startAttr + ">\n" + body + "</" + type2 + ">\n";
      }
      listitem(item) {
        let itemBody = "";
        if (item.task) {
          const checkbox = this.checkbox({ checked: !!item.checked });
          if (item.loose) {
            if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
              item.tokens[0].text = checkbox + " " + item.tokens[0].text;
              if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
                item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
              }
            } else {
              item.tokens.unshift({
                type: "text",
                raw: checkbox + " ",
                text: checkbox + " "
              });
            }
          } else {
            itemBody += checkbox + " ";
          }
        }
        itemBody += this.parser.parse(item.tokens, !!item.loose);
        return `<li>${itemBody}</li>
`;
      }
      checkbox({ checked }) {
        return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
      }
      paragraph({ tokens }) {
        return `<p>${this.parser.parseInline(tokens)}</p>
`;
      }
      table(token) {
        let header = "";
        let cell = "";
        for (let j = 0; j < token.header.length; j++) {
          cell += this.tablecell(token.header[j]);
        }
        header += this.tablerow({ text: cell });
        let body = "";
        for (let j = 0; j < token.rows.length; j++) {
          const row = token.rows[j];
          cell = "";
          for (let k = 0; k < row.length; k++) {
            cell += this.tablecell(row[k]);
          }
          body += this.tablerow({ text: cell });
        }
        if (body)
          body = `<tbody>${body}</tbody>`;
        return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
      }
      tablerow({ text }) {
        return `<tr>
${text}</tr>
`;
      }
      tablecell(token) {
        const content = this.parser.parseInline(token.tokens);
        const type2 = token.header ? "th" : "td";
        const tag2 = token.align ? `<${type2} align="${token.align}">` : `<${type2}>`;
        return tag2 + content + `</${type2}>
`;
      }
      /**
       * span level renderer
       */
      strong({ tokens }) {
        return `<strong>${this.parser.parseInline(tokens)}</strong>`;
      }
      em({ tokens }) {
        return `<em>${this.parser.parseInline(tokens)}</em>`;
      }
      codespan({ text }) {
        return `<code>${text}</code>`;
      }
      br(token) {
        return "<br>";
      }
      del({ tokens }) {
        return `<del>${this.parser.parseInline(tokens)}</del>`;
      }
      link({ href, title, tokens }) {
        const text = this.parser.parseInline(tokens);
        const cleanHref = cleanUrl(href);
        if (cleanHref === null) {
          return text;
        }
        href = cleanHref;
        let out = '<a href="' + href + '"';
        if (title) {
          out += ' title="' + title + '"';
        }
        out += ">" + text + "</a>";
        return out;
      }
      image({ href, title, text }) {
        const cleanHref = cleanUrl(href);
        if (cleanHref === null) {
          return text;
        }
        href = cleanHref;
        let out = `<img src="${href}" alt="${text}"`;
        if (title) {
          out += ` title="${title}"`;
        }
        out += ">";
        return out;
      }
      text(token) {
        return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : token.text;
      }
    };
    _TextRenderer = class {
      // no need for block level renderers
      strong({ text }) {
        return text;
      }
      em({ text }) {
        return text;
      }
      codespan({ text }) {
        return text;
      }
      del({ text }) {
        return text;
      }
      html({ text }) {
        return text;
      }
      text({ text }) {
        return text;
      }
      link({ text }) {
        return "" + text;
      }
      image({ text }) {
        return "" + text;
      }
      br() {
        return "";
      }
    };
    _Parser = class __Parser {
      options;
      renderer;
      textRenderer;
      constructor(options2) {
        this.options = options2 || _defaults;
        this.options.renderer = this.options.renderer || new _Renderer();
        this.renderer = this.options.renderer;
        this.renderer.options = this.options;
        this.renderer.parser = this;
        this.textRenderer = new _TextRenderer();
      }
      /**
       * Static Parse Method
       */
      static parse(tokens, options2) {
        const parser2 = new __Parser(options2);
        return parser2.parse(tokens);
      }
      /**
       * Static Parse Inline Method
       */
      static parseInline(tokens, options2) {
        const parser2 = new __Parser(options2);
        return parser2.parseInline(tokens);
      }
      /**
       * Parse Loop
       */
      parse(tokens, top = true) {
        let out = "";
        for (let i = 0; i < tokens.length; i++) {
          const anyToken = tokens[i];
          if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
            const genericToken = anyToken;
            const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
            if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
              out += ret || "";
              continue;
            }
          }
          const token = anyToken;
          switch (token.type) {
            case "space": {
              out += this.renderer.space(token);
              continue;
            }
            case "hr": {
              out += this.renderer.hr(token);
              continue;
            }
            case "heading": {
              out += this.renderer.heading(token);
              continue;
            }
            case "code": {
              out += this.renderer.code(token);
              continue;
            }
            case "table": {
              out += this.renderer.table(token);
              continue;
            }
            case "blockquote": {
              out += this.renderer.blockquote(token);
              continue;
            }
            case "list": {
              out += this.renderer.list(token);
              continue;
            }
            case "html": {
              out += this.renderer.html(token);
              continue;
            }
            case "paragraph": {
              out += this.renderer.paragraph(token);
              continue;
            }
            case "text": {
              let textToken = token;
              let body = this.renderer.text(textToken);
              while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
                textToken = tokens[++i];
                body += "\n" + this.renderer.text(textToken);
              }
              if (top) {
                out += this.renderer.paragraph({
                  type: "paragraph",
                  raw: body,
                  text: body,
                  tokens: [{ type: "text", raw: body, text: body }]
                });
              } else {
                out += body;
              }
              continue;
            }
            default: {
              const errMsg = 'Token with "' + token.type + '" type was not found.';
              if (this.options.silent) {
                console.error(errMsg);
                return "";
              } else {
                throw new Error(errMsg);
              }
            }
          }
        }
        return out;
      }
      /**
       * Parse Inline Tokens
       */
      parseInline(tokens, renderer) {
        renderer = renderer || this.renderer;
        let out = "";
        for (let i = 0; i < tokens.length; i++) {
          const anyToken = tokens[i];
          if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
            const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
            if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
              out += ret || "";
              continue;
            }
          }
          const token = anyToken;
          switch (token.type) {
            case "escape": {
              out += renderer.text(token);
              break;
            }
            case "html": {
              out += renderer.html(token);
              break;
            }
            case "link": {
              out += renderer.link(token);
              break;
            }
            case "image": {
              out += renderer.image(token);
              break;
            }
            case "strong": {
              out += renderer.strong(token);
              break;
            }
            case "em": {
              out += renderer.em(token);
              break;
            }
            case "codespan": {
              out += renderer.codespan(token);
              break;
            }
            case "br": {
              out += renderer.br(token);
              break;
            }
            case "del": {
              out += renderer.del(token);
              break;
            }
            case "text": {
              out += renderer.text(token);
              break;
            }
            default: {
              const errMsg = 'Token with "' + token.type + '" type was not found.';
              if (this.options.silent) {
                console.error(errMsg);
                return "";
              } else {
                throw new Error(errMsg);
              }
            }
          }
        }
        return out;
      }
    };
    _Hooks = class {
      options;
      constructor(options2) {
        this.options = options2 || _defaults;
      }
      static passThroughHooks = /* @__PURE__ */ new Set([
        "preprocess",
        "postprocess",
        "processAllTokens"
      ]);
      /**
       * Process markdown before marked
       */
      preprocess(markdown) {
        return markdown;
      }
      /**
       * Process HTML after marked is finished
       */
      postprocess(html2) {
        return html2;
      }
      /**
       * Process all tokens before walk tokens
       */
      processAllTokens(tokens) {
        return tokens;
      }
    };
    Marked = class {
      defaults = _getDefaults();
      options = this.setOptions;
      parse = this.parseMarkdown(_Lexer.lex, _Parser.parse);
      parseInline = this.parseMarkdown(_Lexer.lexInline, _Parser.parseInline);
      Parser = _Parser;
      Renderer = _Renderer;
      TextRenderer = _TextRenderer;
      Lexer = _Lexer;
      Tokenizer = _Tokenizer;
      Hooks = _Hooks;
      constructor(...args) {
        this.use(...args);
      }
      /**
       * Run callback for every token
       */
      walkTokens(tokens, callback) {
        let values = [];
        for (const token of tokens) {
          values = values.concat(callback.call(this, token));
          switch (token.type) {
            case "table": {
              const tableToken = token;
              for (const cell of tableToken.header) {
                values = values.concat(this.walkTokens(cell.tokens, callback));
              }
              for (const row of tableToken.rows) {
                for (const cell of row) {
                  values = values.concat(this.walkTokens(cell.tokens, callback));
                }
              }
              break;
            }
            case "list": {
              const listToken = token;
              values = values.concat(this.walkTokens(listToken.items, callback));
              break;
            }
            default: {
              const genericToken = token;
              if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
                this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
                  const tokens2 = genericToken[childTokens].flat(Infinity);
                  values = values.concat(this.walkTokens(tokens2, callback));
                });
              } else if (genericToken.tokens) {
                values = values.concat(this.walkTokens(genericToken.tokens, callback));
              }
            }
          }
        }
        return values;
      }
      use(...args) {
        const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
        args.forEach((pack) => {
          const opts = { ...pack };
          opts.async = this.defaults.async || opts.async || false;
          if (pack.extensions) {
            pack.extensions.forEach((ext) => {
              if (!ext.name) {
                throw new Error("extension name required");
              }
              if ("renderer" in ext) {
                const prevRenderer = extensions.renderers[ext.name];
                if (prevRenderer) {
                  extensions.renderers[ext.name] = function(...args2) {
                    let ret = ext.renderer.apply(this, args2);
                    if (ret === false) {
                      ret = prevRenderer.apply(this, args2);
                    }
                    return ret;
                  };
                } else {
                  extensions.renderers[ext.name] = ext.renderer;
                }
              }
              if ("tokenizer" in ext) {
                if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
                  throw new Error("extension level must be 'block' or 'inline'");
                }
                const extLevel = extensions[ext.level];
                if (extLevel) {
                  extLevel.unshift(ext.tokenizer);
                } else {
                  extensions[ext.level] = [ext.tokenizer];
                }
                if (ext.start) {
                  if (ext.level === "block") {
                    if (extensions.startBlock) {
                      extensions.startBlock.push(ext.start);
                    } else {
                      extensions.startBlock = [ext.start];
                    }
                  } else if (ext.level === "inline") {
                    if (extensions.startInline) {
                      extensions.startInline.push(ext.start);
                    } else {
                      extensions.startInline = [ext.start];
                    }
                  }
                }
              }
              if ("childTokens" in ext && ext.childTokens) {
                extensions.childTokens[ext.name] = ext.childTokens;
              }
            });
            opts.extensions = extensions;
          }
          if (pack.renderer) {
            const renderer = this.defaults.renderer || new _Renderer(this.defaults);
            for (const prop in pack.renderer) {
              if (!(prop in renderer)) {
                throw new Error(`renderer '${prop}' does not exist`);
              }
              if (["options", "parser"].includes(prop)) {
                continue;
              }
              const rendererProp = prop;
              const rendererFunc = pack.renderer[rendererProp];
              const prevRenderer = renderer[rendererProp];
              renderer[rendererProp] = (...args2) => {
                let ret = rendererFunc.apply(renderer, args2);
                if (ret === false) {
                  ret = prevRenderer.apply(renderer, args2);
                }
                return ret || "";
              };
            }
            opts.renderer = renderer;
          }
          if (pack.tokenizer) {
            const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
            for (const prop in pack.tokenizer) {
              if (!(prop in tokenizer)) {
                throw new Error(`tokenizer '${prop}' does not exist`);
              }
              if (["options", "rules", "lexer"].includes(prop)) {
                continue;
              }
              const tokenizerProp = prop;
              const tokenizerFunc = pack.tokenizer[tokenizerProp];
              const prevTokenizer = tokenizer[tokenizerProp];
              tokenizer[tokenizerProp] = (...args2) => {
                let ret = tokenizerFunc.apply(tokenizer, args2);
                if (ret === false) {
                  ret = prevTokenizer.apply(tokenizer, args2);
                }
                return ret;
              };
            }
            opts.tokenizer = tokenizer;
          }
          if (pack.hooks) {
            const hooks = this.defaults.hooks || new _Hooks();
            for (const prop in pack.hooks) {
              if (!(prop in hooks)) {
                throw new Error(`hook '${prop}' does not exist`);
              }
              if (prop === "options") {
                continue;
              }
              const hooksProp = prop;
              const hooksFunc = pack.hooks[hooksProp];
              const prevHook = hooks[hooksProp];
              if (_Hooks.passThroughHooks.has(prop)) {
                hooks[hooksProp] = (arg) => {
                  if (this.defaults.async) {
                    return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
                      return prevHook.call(hooks, ret2);
                    });
                  }
                  const ret = hooksFunc.call(hooks, arg);
                  return prevHook.call(hooks, ret);
                };
              } else {
                hooks[hooksProp] = (...args2) => {
                  let ret = hooksFunc.apply(hooks, args2);
                  if (ret === false) {
                    ret = prevHook.apply(hooks, args2);
                  }
                  return ret;
                };
              }
            }
            opts.hooks = hooks;
          }
          if (pack.walkTokens) {
            const walkTokens2 = this.defaults.walkTokens;
            const packWalktokens = pack.walkTokens;
            opts.walkTokens = function(token) {
              let values = [];
              values.push(packWalktokens.call(this, token));
              if (walkTokens2) {
                values = values.concat(walkTokens2.call(this, token));
              }
              return values;
            };
          }
          this.defaults = { ...this.defaults, ...opts };
        });
        return this;
      }
      setOptions(opt) {
        this.defaults = { ...this.defaults, ...opt };
        return this;
      }
      lexer(src, options2) {
        return _Lexer.lex(src, options2 ?? this.defaults);
      }
      parser(tokens, options2) {
        return _Parser.parse(tokens, options2 ?? this.defaults);
      }
      parseMarkdown(lexer2, parser2) {
        const parse6 = (src, options2) => {
          const origOpt = { ...options2 };
          const opt = { ...this.defaults, ...origOpt };
          const throwError = this.onError(!!opt.silent, !!opt.async);
          if (this.defaults.async === true && origOpt.async === false) {
            return throwError(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 src === "undefined" || src === null) {
            return throwError(new Error("marked(): input parameter is undefined or null"));
          }
          if (typeof src !== "string") {
            return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
          }
          if (opt.hooks) {
            opt.hooks.options = opt;
          }
          if (opt.async) {
            return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
          }
          try {
            if (opt.hooks) {
              src = opt.hooks.preprocess(src);
            }
            let tokens = lexer2(src, opt);
            if (opt.hooks) {
              tokens = opt.hooks.processAllTokens(tokens);
            }
            if (opt.walkTokens) {
              this.walkTokens(tokens, opt.walkTokens);
            }
            let html2 = parser2(tokens, opt);
            if (opt.hooks) {
              html2 = opt.hooks.postprocess(html2);
            }
            return html2;
          } catch (e) {
            return throwError(e);
          }
        };
        return parse6;
      }
      onError(silent, async) {
        return (e) => {
          e.message += "\nPlease report this to https://github.com/markedjs/marked.";
          if (silent) {
            const msg = "<p>An error occurred:</p><pre>" + escape$1(e.message + "", true) + "</pre>";
            if (async) {
              return Promise.resolve(msg);
            }
            return msg;
          }
          if (async) {
            return Promise.reject(e);
          }
          throw e;
        };
      }
    };
    markedInstance = new Marked();
    marked.options = marked.setOptions = function(options2) {
      markedInstance.setOptions(options2);
      marked.defaults = markedInstance.defaults;
      changeDefaults(marked.defaults);
      return marked;
    };
    marked.getDefaults = _getDefaults;
    marked.defaults = _defaults;
    marked.use = function(...args) {
      markedInstance.use(...args);
      marked.defaults = markedInstance.defaults;
      changeDefaults(marked.defaults);
      return marked;
    };
    marked.walkTokens = function(tokens, callback) {
      return markedInstance.walkTokens(tokens, callback);
    };
    marked.parseInline = markedInstance.parseInline;
    marked.Parser = _Parser;
    marked.parser = _Parser.parse;
    marked.Renderer = _Renderer;
    marked.TextRenderer = _TextRenderer;
    marked.Lexer = _Lexer;
    marked.lexer = _Lexer.lex;
    marked.Tokenizer = _Tokenizer;
    marked.Hooks = _Hooks;
    marked.parse = marked;
    options = marked.options;
    setOptions = marked.setOptions;
    use = marked.use;
    walkTokens = marked.walkTokens;
    parseInline = marked.parseInline;
    parser = _Parser.parse;
    lexer = _Lexer.lex;
  }
});

// out-build/vs/base/common/prefixTree.js
function* bfsIterate(root) {
  const stack = [root];
  while (stack.length > 0) {
    const node = stack.pop();
    yield node;
    if (node.children) {
      for (const child of node.children.values()) {
        stack.push(child);
      }
    }
  }
}
var unset, $lQ, Node3;
var init_prefixTree = __esm({
  "out-build/vs/base/common/prefixTree.js"() {
    "use strict";
    init_iterator();
    unset = Symbol("unset");
    $lQ = class {
      constructor() {
        this.root = new Node3();
        this.a = 0;
      }
      /** Tree size, not including the root. */
      get size() {
        return this.a;
      }
      /** Gets the top-level nodes of the tree */
      get nodes() {
        return this.root.children?.values() || Iterable.empty();
      }
      /** Gets the top-level nodes of the tree */
      get entries() {
        return this.root.children?.entries() || Iterable.empty();
      }
      /**
       * Inserts a new value in the prefix tree.
       * @param onNode - called for each node as we descend to the insertion point,
       * including the insertion point itself.
       */
      insert(key, value, onNode) {
        this.c(key, (n) => n._value = value, onNode);
      }
      /** Mutates a value in the prefix tree. */
      mutate(key, mutate) {
        this.c(key, (n) => n._value = mutate(n._value === unset ? void 0 : n._value));
      }
      /** Mutates nodes along the path in the prefix tree. */
      mutatePath(key, mutate) {
        this.c(key, () => {
        }, (n) => mutate(n));
      }
      /** Deletes a node from the prefix tree, returning the value it contained. */
      delete(key) {
        const path7 = this.b(key);
        if (!path7) {
          return;
        }
        let i = path7.length - 1;
        const value = path7[i].node._value;
        if (value === unset) {
          return;
        }
        this.a--;
        path7[i].node._value = unset;
        for (; i > 0; i--) {
          const { node, part } = path7[i];
          if (node.children?.size || node._value !== unset) {
            break;
          }
          path7[i - 1].node.children.delete(part);
        }
        return value;
      }
      /** Deletes a subtree from the prefix tree, returning the values they contained. */
      *deleteRecursive(key) {
        const path7 = this.b(key);
        if (!path7) {
          return;
        }
        const subtree = path7[path7.length - 1].node;
        for (let i = path7.length - 1; i > 0; i--) {
          const parent = path7[i - 1];
          parent.node.children.delete(path7[i].part);
          if (parent.node.children.size > 0 || parent.node._value !== unset) {
            break;
          }
        }
        for (const node of bfsIterate(subtree)) {
          if (node._value !== unset) {
            this.a--;
            yield node._value;
          }
        }
        if (subtree === this.root) {
          this.root._value = unset;
          this.root.children = void 0;
        }
      }
      /** Gets a value from the tree. */
      find(key) {
        let node = this.root;
        for (const segment of key) {
          const next = node.children?.get(segment);
          if (!next) {
            return void 0;
          }
          node = next;
        }
        return node._value === unset ? void 0 : node._value;
      }
      /** Gets whether the tree has the key, or a parent of the key, already inserted. */
      hasKeyOrParent(key) {
        let node = this.root;
        for (const segment of key) {
          const next = node.children?.get(segment);
          if (!next) {
            return false;
          }
          if (next._value !== unset) {
            return true;
          }
          node = next;
        }
        return false;
      }
      /** Gets whether the tree has the given key or any children. */
      hasKeyOrChildren(key) {
        let node = this.root;
        for (const segment of key) {
          const next = node.children?.get(segment);
          if (!next) {
            return false;
          }
          node = next;
        }
        return true;
      }
      /** Gets whether the tree has the given key. */
      hasKey(key) {
        let node = this.root;
        for (const segment of key) {
          const next = node.children?.get(segment);
          if (!next) {
            return false;
          }
          node = next;
        }
        return node._value !== unset;
      }
      b(key) {
        const path7 = [{ part: "", node: this.root }];
        let i = 0;
        for (const part of key) {
          const node = path7[i].node.children?.get(part);
          if (!node) {
            return;
          }
          path7.push({ part, node });
          i++;
        }
        return path7;
      }
      c(key, fn, onDescend) {
        let node = this.root;
        for (const part of key) {
          if (!node.children) {
            const next = new Node3();
            node.children = /* @__PURE__ */ new Map([[part, next]]);
            node = next;
          } else if (!node.children.has(part)) {
            const next = new Node3();
            node.children.set(part, next);
            node = next;
          } else {
            node = node.children.get(part);
          }
          onDescend?.(node);
        }
        const sizeBefore = node._value === unset ? 0 : 1;
        fn(node);
        const sizeAfter = node._value === unset ? 0 : 1;
        this.a += sizeAfter - sizeBefore;
      }
      /** Returns an iterable of the tree values in no defined order. */
      *values() {
        for (const { _value } of bfsIterate(this.root)) {
          if (_value !== unset) {
            yield _value;
          }
        }
      }
    };
    Node3 = class {
      constructor() {
        this._value = unset;
      }
      get value() {
        return this._value === unset ? void 0 : this._value;
      }
      set value(value) {
        this._value = value === void 0 ? unset : value;
      }
    };
  }
});

// out-build/vs/editor/common/core/position.js
var $8C;
var init_position = __esm({
  "out-build/vs/editor/common/core/position.js"() {
    "use strict";
    $8C = class _$8C {
      constructor(lineNumber, column) {
        this.lineNumber = lineNumber;
        this.column = column;
      }
      /**
       * Create a new position from this position.
       *
       * @param newLineNumber new line number
       * @param newColumn new column
       */
      with(newLineNumber = this.lineNumber, newColumn = this.column) {
        if (newLineNumber === this.lineNumber && newColumn === this.column) {
          return this;
        } else {
          return new _$8C(newLineNumber, newColumn);
        }
      }
      /**
       * Derive a new position from this position.
       *
       * @param deltaLineNumber line number delta
       * @param deltaColumn column delta
       */
      delta(deltaLineNumber = 0, deltaColumn = 0) {
        return this.with(this.lineNumber + deltaLineNumber, this.column + deltaColumn);
      }
      /**
       * Test if this position equals other position
       */
      equals(other) {
        return _$8C.equals(this, other);
      }
      /**
       * Test if position `a` equals position `b`
       */
      static equals(a, b) {
        if (!a && !b) {
          return true;
        }
        return !!a && !!b && a.lineNumber === b.lineNumber && a.column === b.column;
      }
      /**
       * Test if this position is before other position.
       * If the two positions are equal, the result will be false.
       */
      isBefore(other) {
        return _$8C.isBefore(this, other);
      }
      /**
       * Test if position `a` is before position `b`.
       * If the two positions are equal, the result will be false.
       */
      static isBefore(a, b) {
        if (a.lineNumber < b.lineNumber) {
          return true;
        }
        if (b.lineNumber < a.lineNumber) {
          return false;
        }
        return a.column < b.column;
      }
      /**
       * Test if this position is before other position.
       * If the two positions are equal, the result will be true.
       */
      isBeforeOrEqual(other) {
        return _$8C.isBeforeOrEqual(this, other);
      }
      /**
       * Test if position `a` is before position `b`.
       * If the two positions are equal, the result will be true.
       */
      static isBeforeOrEqual(a, b) {
        if (a.lineNumber < b.lineNumber) {
          return true;
        }
        if (b.lineNumber < a.lineNumber) {
          return false;
        }
        return a.column <= b.column;
      }
      /**
       * A function that compares positions, useful for sorting
       */
      static compare(a, b) {
        const aLineNumber = a.lineNumber | 0;
        const bLineNumber = b.lineNumber | 0;
        if (aLineNumber === bLineNumber) {
          const aColumn = a.column | 0;
          const bColumn = b.column | 0;
          return aColumn - bColumn;
        }
        return aLineNumber - bLineNumber;
      }
      /**
       * Clone this position.
       */
      clone() {
        return new _$8C(this.lineNumber, this.column);
      }
      /**
       * Convert to a human-readable representation.
       */
      toString() {
        return "(" + this.lineNumber + "," + this.column + ")";
      }
      // ---
      /**
       * Create a `Position` from an `IPosition`.
       */
      static lift(pos) {
        return new _$8C(pos.lineNumber, pos.column);
      }
      /**
       * Test if `obj` is an `IPosition`.
       */
      static isIPosition(obj) {
        return obj && typeof obj.lineNumber === "number" && typeof obj.column === "number";
      }
      toJSON() {
        return {
          lineNumber: this.lineNumber,
          column: this.column
        };
      }
    };
  }
});

// out-build/vs/editor/common/core/range.js
var $9C;
var init_range = __esm({
  "out-build/vs/editor/common/core/range.js"() {
    "use strict";
    init_position();
    $9C = class _$9C {
      constructor(startLineNumber, startColumn, endLineNumber, endColumn) {
        if (startLineNumber > endLineNumber || startLineNumber === endLineNumber && startColumn > endColumn) {
          this.startLineNumber = endLineNumber;
          this.startColumn = endColumn;
          this.endLineNumber = startLineNumber;
          this.endColumn = startColumn;
        } else {
          this.startLineNumber = startLineNumber;
          this.startColumn = startColumn;
          this.endLineNumber = endLineNumber;
          this.endColumn = endColumn;
        }
      }
      /**
       * Test if this range is empty.
       */
      isEmpty() {
        return _$9C.isEmpty(this);
      }
      /**
       * Test if `range` is empty.
       */
      static isEmpty(range) {
        return range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn;
      }
      /**
       * Test if position is in this range. If the position is at the edges, will return true.
       */
      containsPosition(position) {
        return _$9C.containsPosition(this, position);
      }
      /**
       * Test if `position` is in `range`. If the position is at the edges, will return true.
       */
      static containsPosition(range, position) {
        if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {
          return false;
        }
        if (position.lineNumber === range.startLineNumber && position.column < range.startColumn) {
          return false;
        }
        if (position.lineNumber === range.endLineNumber && position.column > range.endColumn) {
          return false;
        }
        return true;
      }
      /**
       * Test if `position` is in `range`. If the position is at the edges, will return false.
       * @internal
       */
      static strictContainsPosition(range, position) {
        if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {
          return false;
        }
        if (position.lineNumber === range.startLineNumber && position.column <= range.startColumn) {
          return false;
        }
        if (position.lineNumber === range.endLineNumber && position.column >= range.endColumn) {
          return false;
        }
        return true;
      }
      /**
       * Test if range is in this range. If the range is equal to this range, will return true.
       */
      containsRange(range) {
        return _$9C.containsRange(this, range);
      }
      /**
       * Test if `otherRange` is in `range`. If the ranges are equal, will return true.
       */
      static containsRange(range, otherRange) {
        if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {
          return false;
        }
        if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {
          return false;
        }
        if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn < range.startColumn) {
          return false;
        }
        if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn > range.endColumn) {
          return false;
        }
        return true;
      }
      /**
       * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.
       */
      strictContainsRange(range) {
        return _$9C.strictContainsRange(this, range);
      }
      /**
       * Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false.
       */
      static strictContainsRange(range, otherRange) {
        if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {
          return false;
        }
        if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {
          return false;
        }
        if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn <= range.startColumn) {
          return false;
        }
        if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn >= range.endColumn) {
          return false;
        }
        return true;
      }
      /**
       * A reunion of the two ranges.
       * The smallest position will be used as the start point, and the largest one as the end point.
       */
      plusRange(range) {
        return _$9C.plusRange(this, range);
      }
      /**
       * A reunion of the two ranges.
       * The smallest position will be used as the start point, and the largest one as the end point.
       */
      static plusRange(a, b) {
        let startLineNumber;
        let startColumn;
        let endLineNumber;
        let endColumn;
        if (b.startLineNumber < a.startLineNumber) {
          startLineNumber = b.startLineNumber;
          startColumn = b.startColumn;
        } else if (b.startLineNumber === a.startLineNumber) {
          startLineNumber = b.startLineNumber;
          startColumn = Math.min(b.startColumn, a.startColumn);
        } else {
          startLineNumber = a.startLineNumber;
          startColumn = a.startColumn;
        }
        if (b.endLineNumber > a.endLineNumber) {
          endLineNumber = b.endLineNumber;
          endColumn = b.endColumn;
        } else if (b.endLineNumber === a.endLineNumber) {
          endLineNumber = b.endLineNumber;
          endColumn = Math.max(b.endColumn, a.endColumn);
        } else {
          endLineNumber = a.endLineNumber;
          endColumn = a.endColumn;
        }
        return new _$9C(startLineNumber, startColumn, endLineNumber, endColumn);
      }
      /**
       * A intersection of the two ranges.
       */
      intersectRanges(range) {
        return _$9C.intersectRanges(this, range);
      }
      /**
       * A intersection of the two ranges.
       */
      static intersectRanges(a, b) {
        let resultStartLineNumber = a.startLineNumber;
        let resultStartColumn = a.startColumn;
        let resultEndLineNumber = a.endLineNumber;
        let resultEndColumn = a.endColumn;
        const otherStartLineNumber = b.startLineNumber;
        const otherStartColumn = b.startColumn;
        const otherEndLineNumber = b.endLineNumber;
        const otherEndColumn = b.endColumn;
        if (resultStartLineNumber < otherStartLineNumber) {
          resultStartLineNumber = otherStartLineNumber;
          resultStartColumn = otherStartColumn;
        } else if (resultStartLineNumber === otherStartLineNumber) {
          resultStartColumn = Math.max(resultStartColumn, otherStartColumn);
        }
        if (resultEndLineNumber > otherEndLineNumber) {
          resultEndLineNumber = otherEndLineNumber;
          resultEndColumn = otherEndColumn;
        } else if (resultEndLineNumber === otherEndLineNumber) {
          resultEndColumn = Math.min(resultEndColumn, otherEndColumn);
        }
        if (resultStartLineNumber > resultEndLineNumber) {
          return null;
        }
        if (resultStartLineNumber === resultEndLineNumber && resultStartColumn > resultEndColumn) {
          return null;
        }
        return new _$9C(resultStartLineNumber, resultStartColumn, resultEndLineNumber, resultEndColumn);
      }
      /**
       * Test if this range equals other.
       */
      equalsRange(other) {
        return _$9C.equalsRange(this, other);
      }
      /**
       * Test if range `a` equals `b`.
       */
      static equalsRange(a, b) {
        if (!a && !b) {
          return true;
        }
        return !!a && !!b && a.startLineNumber === b.startLineNumber && a.startColumn === b.startColumn && a.endLineNumber === b.endLineNumber && a.endColumn === b.endColumn;
      }
      /**
       * Return the end position (which will be after or equal to the start position)
       */
      getEndPosition() {
        return _$9C.getEndPosition(this);
      }
      /**
       * Return the end position (which will be after or equal to the start position)
       */
      static getEndPosition(range) {
        return new $8C(range.endLineNumber, range.endColumn);
      }
      /**
       * Return the start position (which will be before or equal to the end position)
       */
      getStartPosition() {
        return _$9C.getStartPosition(this);
      }
      /**
       * Return the start position (which will be before or equal to the end position)
       */
      static getStartPosition(range) {
        return new $8C(range.startLineNumber, range.startColumn);
      }
      /**
       * Transform to a user presentable string representation.
       */
      toString() {
        return "[" + this.startLineNumber + "," + this.startColumn + " -> " + this.endLineNumber + "," + this.endColumn + "]";
      }
      /**
       * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
       */
      setEndPosition(endLineNumber, endColumn) {
        return new _$9C(this.startLineNumber, this.startColumn, endLineNumber, endColumn);
      }
      /**
       * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
       */
      setStartPosition(startLineNumber, startColumn) {
        return new _$9C(startLineNumber, startColumn, this.endLineNumber, this.endColumn);
      }
      /**
       * Create a new empty range using this range's start position.
       */
      collapseToStart() {
        return _$9C.collapseToStart(this);
      }
      /**
       * Create a new empty range using this range's start position.
       */
      static collapseToStart(range) {
        return new _$9C(range.startLineNumber, range.startColumn, range.startLineNumber, range.startColumn);
      }
      /**
       * Create a new empty range using this range's end position.
       */
      collapseToEnd() {
        return _$9C.collapseToEnd(this);
      }
      /**
       * Create a new empty range using this range's end position.
       */
      static collapseToEnd(range) {
        return new _$9C(range.endLineNumber, range.endColumn, range.endLineNumber, range.endColumn);
      }
      /**
       * Moves the range by the given amount of lines.
       */
      delta(lineCount) {
        return new _$9C(this.startLineNumber + lineCount, this.startColumn, this.endLineNumber + lineCount, this.endColumn);
      }
      // ---
      static fromPositions(start, end = start) {
        return new _$9C(start.lineNumber, start.column, end.lineNumber, end.column);
      }
      static lift(range) {
        if (!range) {
          return null;
        }
        return new _$9C(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);
      }
      /**
       * Test if `obj` is an `IRange`.
       */
      static isIRange(obj) {
        return obj && typeof obj.startLineNumber === "number" && typeof obj.startColumn === "number" && typeof obj.endLineNumber === "number" && typeof obj.endColumn === "number";
      }
      /**
       * Test if the two ranges are touching in any way.
       */
      static areIntersectingOrTouching(a, b) {
        if (a.endLineNumber < b.startLineNumber || a.endLineNumber === b.startLineNumber && a.endColumn < b.startColumn) {
          return false;
        }
        if (b.endLineNumber < a.startLineNumber || b.endLineNumber === a.startLineNumber && b.endColumn < a.startColumn) {
          return false;
        }
        return true;
      }
      /**
       * Test if the two ranges are intersecting. If the ranges are touching it returns true.
       */
      static areIntersecting(a, b) {
        if (a.endLineNumber < b.startLineNumber || a.endLineNumber === b.startLineNumber && a.endColumn <= b.startColumn) {
          return false;
        }
        if (b.endLineNumber < a.startLineNumber || b.endLineNumber === a.startLineNumber && b.endColumn <= a.startColumn) {
          return false;
        }
        return true;
      }
      /**
       * A function that compares ranges, useful for sorting ranges
       * It will first compare ranges on the startPosition and then on the endPosition
       */
      static compareRangesUsingStarts(a, b) {
        if (a && b) {
          const aStartLineNumber = a.startLineNumber | 0;
          const bStartLineNumber = b.startLineNumber | 0;
          if (aStartLineNumber === bStartLineNumber) {
            const aStartColumn = a.startColumn | 0;
            const bStartColumn = b.startColumn | 0;
            if (aStartColumn === bStartColumn) {
              const aEndLineNumber = a.endLineNumber | 0;
              const bEndLineNumber = b.endLineNumber | 0;
              if (aEndLineNumber === bEndLineNumber) {
                const aEndColumn = a.endColumn | 0;
                const bEndColumn = b.endColumn | 0;
                return aEndColumn - bEndColumn;
              }
              return aEndLineNumber - bEndLineNumber;
            }
            return aStartColumn - bStartColumn;
          }
          return aStartLineNumber - bStartLineNumber;
        }
        const aExists = a ? 1 : 0;
        const bExists = b ? 1 : 0;
        return aExists - bExists;
      }
      /**
       * A function that compares ranges, useful for sorting ranges
       * It will first compare ranges on the endPosition and then on the startPosition
       */
      static compareRangesUsingEnds(a, b) {
        if (a.endLineNumber === b.endLineNumber) {
          if (a.endColumn === b.endColumn) {
            if (a.startLineNumber === b.startLineNumber) {
              return a.startColumn - b.startColumn;
            }
            return a.startLineNumber - b.startLineNumber;
          }
          return a.endColumn - b.endColumn;
        }
        return a.endLineNumber - b.endLineNumber;
      }
      /**
       * Test if the range spans multiple lines.
       */
      static spansMultipleLines(range) {
        return range.endLineNumber > range.startLineNumber;
      }
      toJSON() {
        return this;
      }
    };
  }
});

// out-build/vs/editor/common/core/editOperation.js
var init_editOperation = __esm({
  "out-build/vs/editor/common/core/editOperation.js"() {
    "use strict";
    init_range();
  }
});

// out-build/vs/editor/common/tokenizationRegistry.js
var $sE, TokenizationSupportFactoryData;
var init_tokenizationRegistry = __esm({
  "out-build/vs/editor/common/tokenizationRegistry.js"() {
    "use strict";
    init_event();
    init_lifecycle();
    $sE = class {
      constructor() {
        this.a = /* @__PURE__ */ new Map();
        this.b = /* @__PURE__ */ new Map();
        this.c = new $ze();
        this.onDidChange = this.c.event;
        this.d = null;
      }
      handleChange(languageIds) {
        this.c.fire({
          changedLanguages: languageIds,
          changedColorMap: false
        });
      }
      register(languageId, support) {
        this.a.set(languageId, support);
        this.handleChange([languageId]);
        return $1c(() => {
          if (this.a.get(languageId) !== support) {
            return;
          }
          this.a.delete(languageId);
          this.handleChange([languageId]);
        });
      }
      get(languageId) {
        return this.a.get(languageId) || null;
      }
      registerFactory(languageId, factory) {
        this.b.get(languageId)?.dispose();
        const myData = new TokenizationSupportFactoryData(this, languageId, factory);
        this.b.set(languageId, myData);
        return $1c(() => {
          const v = this.b.get(languageId);
          if (!v || v !== myData) {
            return;
          }
          this.b.delete(languageId);
          v.dispose();
        });
      }
      async getOrCreate(languageId) {
        const tokenizationSupport = this.get(languageId);
        if (tokenizationSupport) {
          return tokenizationSupport;
        }
        const factory = this.b.get(languageId);
        if (!factory || factory.isResolved) {
          return null;
        }
        await factory.resolve();
        return this.get(languageId);
      }
      isResolved(languageId) {
        const tokenizationSupport = this.get(languageId);
        if (tokenizationSupport) {
          return true;
        }
        const factory = this.b.get(languageId);
        if (!factory || factory.isResolved) {
          return true;
        }
        return false;
      }
      setColorMap(colorMap) {
        this.d = colorMap;
        this.c.fire({
          changedLanguages: Array.from(this.a.keys()),
          changedColorMap: true
        });
      }
      getColorMap() {
        return this.d;
      }
      getDefaultBackground() {
        if (this.d && this.d.length > 2) {
          return this.d[
            2
            /* ColorId.DefaultBackground */
          ];
        }
        return null;
      }
    };
    TokenizationSupportFactoryData = class extends $3c {
      get isResolved() {
        return this.c;
      }
      constructor(f, g, h) {
        super();
        this.f = f;
        this.g = g;
        this.h = h;
        this.a = false;
        this.b = null;
        this.c = false;
      }
      dispose() {
        this.a = true;
        super.dispose();
      }
      async resolve() {
        if (!this.b) {
          this.b = this.j();
        }
        return this.b;
      }
      async j() {
        const value = await this.h.tokenizationSupport;
        this.c = true;
        if (value && !this.a) {
          this.B(this.f.register(this.g, value));
        }
      }
    };
  }
});

// out-build/vs/editor/common/languages.js
var HoverVerbosityAction2, CompletionItemKind2, CompletionItemKinds, CompletionItemTag2, CompletionItemInsertTextRule, PartialAcceptTriggerKind2, CompletionTriggerKind2, InlineCompletionTriggerKind2, CodeActionTriggerType, DocumentPasteTriggerKind2, SignatureHelpTriggerKind2, DocumentHighlightKind2, SymbolKind2, $TE, SymbolTag2, SymbolKinds, $WE, NewSymbolNameTag2, NewSymbolNameTriggerKind2, Command, CommentThreadCollapsibleState2, CommentThreadState2, CommentThreadApplicability2, CommentMode2, CommentState2, InlayHintKind2, $YE, $ZE, ExternalUriOpenerPriority2, InlineEditTriggerKind2;
var init_languages = __esm({
  "out-build/vs/editor/common/languages.js"() {
    "use strict";
    init_codicons();
    init_uri();
    init_editOperation();
    init_range();
    init_tokenizationRegistry();
    init_nls2();
    (function(HoverVerbosityAction3) {
      HoverVerbosityAction3[HoverVerbosityAction3["Increase"] = 0] = "Increase";
      HoverVerbosityAction3[HoverVerbosityAction3["Decrease"] = 1] = "Decrease";
    })(HoverVerbosityAction2 || (HoverVerbosityAction2 = {}));
    (function(CompletionItemKind4) {
      CompletionItemKind4[CompletionItemKind4["Method"] = 0] = "Method";
      CompletionItemKind4[CompletionItemKind4["Function"] = 1] = "Function";
      CompletionItemKind4[CompletionItemKind4["Constructor"] = 2] = "Constructor";
      CompletionItemKind4[CompletionItemKind4["Field"] = 3] = "Field";
      CompletionItemKind4[CompletionItemKind4["Variable"] = 4] = "Variable";
      CompletionItemKind4[CompletionItemKind4["Class"] = 5] = "Class";
      CompletionItemKind4[CompletionItemKind4["Struct"] = 6] = "Struct";
      CompletionItemKind4[CompletionItemKind4["Interface"] = 7] = "Interface";
      CompletionItemKind4[CompletionItemKind4["Module"] = 8] = "Module";
      CompletionItemKind4[CompletionItemKind4["Property"] = 9] = "Property";
      CompletionItemKind4[CompletionItemKind4["Event"] = 10] = "Event";
      CompletionItemKind4[CompletionItemKind4["Operator"] = 11] = "Operator";
      CompletionItemKind4[CompletionItemKind4["Unit"] = 12] = "Unit";
      CompletionItemKind4[CompletionItemKind4["Value"] = 13] = "Value";
      CompletionItemKind4[CompletionItemKind4["Constant"] = 14] = "Constant";
      CompletionItemKind4[CompletionItemKind4["Enum"] = 15] = "Enum";
      CompletionItemKind4[CompletionItemKind4["EnumMember"] = 16] = "EnumMember";
      CompletionItemKind4[CompletionItemKind4["Keyword"] = 17] = "Keyword";
      CompletionItemKind4[CompletionItemKind4["Text"] = 18] = "Text";
      CompletionItemKind4[CompletionItemKind4["Color"] = 19] = "Color";
      CompletionItemKind4[CompletionItemKind4["File"] = 20] = "File";
      CompletionItemKind4[CompletionItemKind4["Reference"] = 21] = "Reference";
      CompletionItemKind4[CompletionItemKind4["Customcolor"] = 22] = "Customcolor";
      CompletionItemKind4[CompletionItemKind4["Folder"] = 23] = "Folder";
      CompletionItemKind4[CompletionItemKind4["TypeParameter"] = 24] = "TypeParameter";
      CompletionItemKind4[CompletionItemKind4["User"] = 25] = "User";
      CompletionItemKind4[CompletionItemKind4["Issue"] = 26] = "Issue";
      CompletionItemKind4[CompletionItemKind4["Snippet"] = 27] = "Snippet";
    })(CompletionItemKind2 || (CompletionItemKind2 = {}));
    (function(CompletionItemKinds2) {
      const byKind = /* @__PURE__ */ new Map();
      byKind.set(0, $6l.symbolMethod);
      byKind.set(1, $6l.symbolFunction);
      byKind.set(2, $6l.symbolConstructor);
      byKind.set(3, $6l.symbolField);
      byKind.set(4, $6l.symbolVariable);
      byKind.set(5, $6l.symbolClass);
      byKind.set(6, $6l.symbolStruct);
      byKind.set(7, $6l.symbolInterface);
      byKind.set(8, $6l.symbolModule);
      byKind.set(9, $6l.symbolProperty);
      byKind.set(10, $6l.symbolEvent);
      byKind.set(11, $6l.symbolOperator);
      byKind.set(12, $6l.symbolUnit);
      byKind.set(13, $6l.symbolValue);
      byKind.set(15, $6l.symbolEnum);
      byKind.set(14, $6l.symbolConstant);
      byKind.set(15, $6l.symbolEnum);
      byKind.set(16, $6l.symbolEnumMember);
      byKind.set(17, $6l.symbolKeyword);
      byKind.set(27, $6l.symbolSnippet);
      byKind.set(18, $6l.symbolText);
      byKind.set(19, $6l.symbolColor);
      byKind.set(20, $6l.symbolFile);
      byKind.set(21, $6l.symbolReference);
      byKind.set(22, $6l.symbolCustomColor);
      byKind.set(23, $6l.symbolFolder);
      byKind.set(24, $6l.symbolTypeParameter);
      byKind.set(25, $6l.account);
      byKind.set(26, $6l.issues);
      function toIcon(kind) {
        let codicon = byKind.get(kind);
        if (!codicon) {
          console.info("No codicon found for CompletionItemKind " + kind);
          codicon = $6l.symbolProperty;
        }
        return codicon;
      }
      CompletionItemKinds2.toIcon = toIcon;
      const data = /* @__PURE__ */ new Map();
      data.set(
        "method",
        0
        /* CompletionItemKind.Method */
      );
      data.set(
        "function",
        1
        /* CompletionItemKind.Function */
      );
      data.set(
        "constructor",
        2
        /* CompletionItemKind.Constructor */
      );
      data.set(
        "field",
        3
        /* CompletionItemKind.Field */
      );
      data.set(
        "variable",
        4
        /* CompletionItemKind.Variable */
      );
      data.set(
        "class",
        5
        /* CompletionItemKind.Class */
      );
      data.set(
        "struct",
        6
        /* CompletionItemKind.Struct */
      );
      data.set(
        "interface",
        7
        /* CompletionItemKind.Interface */
      );
      data.set(
        "module",
        8
        /* CompletionItemKind.Module */
      );
      data.set(
        "property",
        9
        /* CompletionItemKind.Property */
      );
      data.set(
        "event",
        10
        /* CompletionItemKind.Event */
      );
      data.set(
        "operator",
        11
        /* CompletionItemKind.Operator */
      );
      data.set(
        "unit",
        12
        /* CompletionItemKind.Unit */
      );
      data.set(
        "value",
        13
        /* CompletionItemKind.Value */
      );
      data.set(
        "constant",
        14
        /* CompletionItemKind.Constant */
      );
      data.set(
        "enum",
        15
        /* CompletionItemKind.Enum */
      );
      data.set(
        "enum-member",
        16
        /* CompletionItemKind.EnumMember */
      );
      data.set(
        "enumMember",
        16
        /* CompletionItemKind.EnumMember */
      );
      data.set(
        "keyword",
        17
        /* CompletionItemKind.Keyword */
      );
      data.set(
        "snippet",
        27
        /* CompletionItemKind.Snippet */
      );
      data.set(
        "text",
        18
        /* CompletionItemKind.Text */
      );
      data.set(
        "color",
        19
        /* CompletionItemKind.Color */
      );
      data.set(
        "file",
        20
        /* CompletionItemKind.File */
      );
      data.set(
        "reference",
        21
        /* CompletionItemKind.Reference */
      );
      data.set(
        "customcolor",
        22
        /* CompletionItemKind.Customcolor */
      );
      data.set(
        "folder",
        23
        /* CompletionItemKind.Folder */
      );
      data.set(
        "type-parameter",
        24
        /* CompletionItemKind.TypeParameter */
      );
      data.set(
        "typeParameter",
        24
        /* CompletionItemKind.TypeParameter */
      );
      data.set(
        "account",
        25
        /* CompletionItemKind.User */
      );
      data.set(
        "issue",
        26
        /* CompletionItemKind.Issue */
      );
      function fromString(value, strict) {
        let res = data.get(value);
        if (typeof res === "undefined" && !strict) {
          res = 9;
        }
        return res;
      }
      CompletionItemKinds2.fromString = fromString;
    })(CompletionItemKinds || (CompletionItemKinds = {}));
    (function(CompletionItemTag4) {
      CompletionItemTag4[CompletionItemTag4["Deprecated"] = 1] = "Deprecated";
    })(CompletionItemTag2 || (CompletionItemTag2 = {}));
    (function(CompletionItemInsertTextRule2) {
      CompletionItemInsertTextRule2[CompletionItemInsertTextRule2["None"] = 0] = "None";
      CompletionItemInsertTextRule2[CompletionItemInsertTextRule2["KeepWhitespace"] = 1] = "KeepWhitespace";
      CompletionItemInsertTextRule2[CompletionItemInsertTextRule2["InsertAsSnippet"] = 4] = "InsertAsSnippet";
    })(CompletionItemInsertTextRule || (CompletionItemInsertTextRule = {}));
    (function(PartialAcceptTriggerKind4) {
      PartialAcceptTriggerKind4[PartialAcceptTriggerKind4["Word"] = 0] = "Word";
      PartialAcceptTriggerKind4[PartialAcceptTriggerKind4["Line"] = 1] = "Line";
      PartialAcceptTriggerKind4[PartialAcceptTriggerKind4["Suggest"] = 2] = "Suggest";
    })(PartialAcceptTriggerKind2 || (PartialAcceptTriggerKind2 = {}));
    (function(CompletionTriggerKind4) {
      CompletionTriggerKind4[CompletionTriggerKind4["Invoke"] = 0] = "Invoke";
      CompletionTriggerKind4[CompletionTriggerKind4["TriggerCharacter"] = 1] = "TriggerCharacter";
      CompletionTriggerKind4[CompletionTriggerKind4["TriggerForIncompleteCompletions"] = 2] = "TriggerForIncompleteCompletions";
    })(CompletionTriggerKind2 || (CompletionTriggerKind2 = {}));
    (function(InlineCompletionTriggerKind3) {
      InlineCompletionTriggerKind3[InlineCompletionTriggerKind3["Automatic"] = 0] = "Automatic";
      InlineCompletionTriggerKind3[InlineCompletionTriggerKind3["Explicit"] = 1] = "Explicit";
    })(InlineCompletionTriggerKind2 || (InlineCompletionTriggerKind2 = {}));
    (function(CodeActionTriggerType2) {
      CodeActionTriggerType2[CodeActionTriggerType2["Invoke"] = 1] = "Invoke";
      CodeActionTriggerType2[CodeActionTriggerType2["Auto"] = 2] = "Auto";
    })(CodeActionTriggerType || (CodeActionTriggerType = {}));
    (function(DocumentPasteTriggerKind3) {
      DocumentPasteTriggerKind3[DocumentPasteTriggerKind3["Automatic"] = 0] = "Automatic";
      DocumentPasteTriggerKind3[DocumentPasteTriggerKind3["PasteAs"] = 1] = "PasteAs";
    })(DocumentPasteTriggerKind2 || (DocumentPasteTriggerKind2 = {}));
    (function(SignatureHelpTriggerKind3) {
      SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["Invoke"] = 1] = "Invoke";
      SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["TriggerCharacter"] = 2] = "TriggerCharacter";
      SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["ContentChange"] = 3] = "ContentChange";
    })(SignatureHelpTriggerKind2 || (SignatureHelpTriggerKind2 = {}));
    (function(DocumentHighlightKind3) {
      DocumentHighlightKind3[DocumentHighlightKind3["Text"] = 0] = "Text";
      DocumentHighlightKind3[DocumentHighlightKind3["Read"] = 1] = "Read";
      DocumentHighlightKind3[DocumentHighlightKind3["Write"] = 2] = "Write";
    })(DocumentHighlightKind2 || (DocumentHighlightKind2 = {}));
    (function(SymbolKind4) {
      SymbolKind4[SymbolKind4["File"] = 0] = "File";
      SymbolKind4[SymbolKind4["Module"] = 1] = "Module";
      SymbolKind4[SymbolKind4["Namespace"] = 2] = "Namespace";
      SymbolKind4[SymbolKind4["Package"] = 3] = "Package";
      SymbolKind4[SymbolKind4["Class"] = 4] = "Class";
      SymbolKind4[SymbolKind4["Method"] = 5] = "Method";
      SymbolKind4[SymbolKind4["Property"] = 6] = "Property";
      SymbolKind4[SymbolKind4["Field"] = 7] = "Field";
      SymbolKind4[SymbolKind4["Constructor"] = 8] = "Constructor";
      SymbolKind4[SymbolKind4["Enum"] = 9] = "Enum";
      SymbolKind4[SymbolKind4["Interface"] = 10] = "Interface";
      SymbolKind4[SymbolKind4["Function"] = 11] = "Function";
      SymbolKind4[SymbolKind4["Variable"] = 12] = "Variable";
      SymbolKind4[SymbolKind4["Constant"] = 13] = "Constant";
      SymbolKind4[SymbolKind4["String"] = 14] = "String";
      SymbolKind4[SymbolKind4["Number"] = 15] = "Number";
      SymbolKind4[SymbolKind4["Boolean"] = 16] = "Boolean";
      SymbolKind4[SymbolKind4["Array"] = 17] = "Array";
      SymbolKind4[SymbolKind4["Object"] = 18] = "Object";
      SymbolKind4[SymbolKind4["Key"] = 19] = "Key";
      SymbolKind4[SymbolKind4["Null"] = 20] = "Null";
      SymbolKind4[SymbolKind4["EnumMember"] = 21] = "EnumMember";
      SymbolKind4[SymbolKind4["Struct"] = 22] = "Struct";
      SymbolKind4[SymbolKind4["Event"] = 23] = "Event";
      SymbolKind4[SymbolKind4["Operator"] = 24] = "Operator";
      SymbolKind4[SymbolKind4["TypeParameter"] = 25] = "TypeParameter";
    })(SymbolKind2 || (SymbolKind2 = {}));
    $TE = {
      [
        17
        /* SymbolKind.Array */
      ]: localize(804, null),
      [
        16
        /* SymbolKind.Boolean */
      ]: localize(805, null),
      [
        4
        /* SymbolKind.Class */
      ]: localize(806, null),
      [
        13
        /* SymbolKind.Constant */
      ]: localize(807, null),
      [
        8
        /* SymbolKind.Constructor */
      ]: localize(808, null),
      [
        9
        /* SymbolKind.Enum */
      ]: localize(809, null),
      [
        21
        /* SymbolKind.EnumMember */
      ]: localize(810, null),
      [
        23
        /* SymbolKind.Event */
      ]: localize(811, null),
      [
        7
        /* SymbolKind.Field */
      ]: localize(812, null),
      [
        0
        /* SymbolKind.File */
      ]: localize(813, null),
      [
        11
        /* SymbolKind.Function */
      ]: localize(814, null),
      [
        10
        /* SymbolKind.Interface */
      ]: localize(815, null),
      [
        19
        /* SymbolKind.Key */
      ]: localize(816, null),
      [
        5
        /* SymbolKind.Method */
      ]: localize(817, null),
      [
        1
        /* SymbolKind.Module */
      ]: localize(818, null),
      [
        2
        /* SymbolKind.Namespace */
      ]: localize(819, null),
      [
        20
        /* SymbolKind.Null */
      ]: localize(820, null),
      [
        15
        /* SymbolKind.Number */
      ]: localize(821, null),
      [
        18
        /* SymbolKind.Object */
      ]: localize(822, null),
      [
        24
        /* SymbolKind.Operator */
      ]: localize(823, null),
      [
        3
        /* SymbolKind.Package */
      ]: localize(824, null),
      [
        6
        /* SymbolKind.Property */
      ]: localize(825, null),
      [
        14
        /* SymbolKind.String */
      ]: localize(826, null),
      [
        22
        /* SymbolKind.Struct */
      ]: localize(827, null),
      [
        25
        /* SymbolKind.TypeParameter */
      ]: localize(828, null),
      [
        12
        /* SymbolKind.Variable */
      ]: localize(829, null)
    };
    (function(SymbolTag4) {
      SymbolTag4[SymbolTag4["Deprecated"] = 1] = "Deprecated";
    })(SymbolTag2 || (SymbolTag2 = {}));
    (function(SymbolKinds2) {
      const byKind = /* @__PURE__ */ new Map();
      byKind.set(0, $6l.symbolFile);
      byKind.set(1, $6l.symbolModule);
      byKind.set(2, $6l.symbolNamespace);
      byKind.set(3, $6l.symbolPackage);
      byKind.set(4, $6l.symbolClass);
      byKind.set(5, $6l.symbolMethod);
      byKind.set(6, $6l.symbolProperty);
      byKind.set(7, $6l.symbolField);
      byKind.set(8, $6l.symbolConstructor);
      byKind.set(9, $6l.symbolEnum);
      byKind.set(10, $6l.symbolInterface);
      byKind.set(11, $6l.symbolFunction);
      byKind.set(12, $6l.symbolVariable);
      byKind.set(13, $6l.symbolConstant);
      byKind.set(14, $6l.symbolString);
      byKind.set(15, $6l.symbolNumber);
      byKind.set(16, $6l.symbolBoolean);
      byKind.set(17, $6l.symbolArray);
      byKind.set(18, $6l.symbolObject);
      byKind.set(19, $6l.symbolKey);
      byKind.set(20, $6l.symbolNull);
      byKind.set(21, $6l.symbolEnumMember);
      byKind.set(22, $6l.symbolStruct);
      byKind.set(23, $6l.symbolEvent);
      byKind.set(24, $6l.symbolOperator);
      byKind.set(25, $6l.symbolTypeParameter);
      function toIcon(kind) {
        let icon = byKind.get(kind);
        if (!icon) {
          console.info("No codicon found for SymbolKind " + kind);
          icon = $6l.symbolProperty;
        }
        return icon;
      }
      SymbolKinds2.toIcon = toIcon;
      const byCompletionKind = /* @__PURE__ */ new Map();
      byCompletionKind.set(
        0,
        20
        /* CompletionItemKind.File */
      );
      byCompletionKind.set(
        1,
        8
        /* CompletionItemKind.Module */
      );
      byCompletionKind.set(
        2,
        8
        /* CompletionItemKind.Module */
      );
      byCompletionKind.set(
        3,
        8
        /* CompletionItemKind.Module */
      );
      byCompletionKind.set(
        4,
        5
        /* CompletionItemKind.Class */
      );
      byCompletionKind.set(
        5,
        0
        /* CompletionItemKind.Method */
      );
      byCompletionKind.set(
        6,
        9
        /* CompletionItemKind.Property */
      );
      byCompletionKind.set(
        7,
        3
        /* CompletionItemKind.Field */
      );
      byCompletionKind.set(
        8,
        2
        /* CompletionItemKind.Constructor */
      );
      byCompletionKind.set(
        9,
        15
        /* CompletionItemKind.Enum */
      );
      byCompletionKind.set(
        10,
        7
        /* CompletionItemKind.Interface */
      );
      byCompletionKind.set(
        11,
        1
        /* CompletionItemKind.Function */
      );
      byCompletionKind.set(
        12,
        4
        /* CompletionItemKind.Variable */
      );
      byCompletionKind.set(
        13,
        14
        /* CompletionItemKind.Constant */
      );
      byCompletionKind.set(
        14,
        18
        /* CompletionItemKind.Text */
      );
      byCompletionKind.set(
        15,
        13
        /* CompletionItemKind.Value */
      );
      byCompletionKind.set(
        16,
        13
        /* CompletionItemKind.Value */
      );
      byCompletionKind.set(
        17,
        13
        /* CompletionItemKind.Value */
      );
      byCompletionKind.set(
        18,
        13
        /* CompletionItemKind.Value */
      );
      byCompletionKind.set(
        19,
        17
        /* CompletionItemKind.Keyword */
      );
      byCompletionKind.set(
        20,
        13
        /* CompletionItemKind.Value */
      );
      byCompletionKind.set(
        21,
        16
        /* CompletionItemKind.EnumMember */
      );
      byCompletionKind.set(
        22,
        6
        /* CompletionItemKind.Struct */
      );
      byCompletionKind.set(
        23,
        10
        /* CompletionItemKind.Event */
      );
      byCompletionKind.set(
        24,
        11
        /* CompletionItemKind.Operator */
      );
      byCompletionKind.set(
        25,
        24
        /* CompletionItemKind.TypeParameter */
      );
      function toCompletionKind(kind) {
        let completionKind = byCompletionKind.get(kind);
        if (completionKind === void 0) {
          console.info("No completion kind found for SymbolKind " + kind);
          completionKind = 20;
        }
        return completionKind;
      }
      SymbolKinds2.toCompletionKind = toCompletionKind;
    })(SymbolKinds || (SymbolKinds = {}));
    $WE = class _$WE {
      static {
        this.Comment = new _$WE("comment");
      }
      static {
        this.Imports = new _$WE("imports");
      }
      static {
        this.Region = new _$WE("region");
      }
      /**
       * Returns a {@link $WE} for the given value.
       *
       * @param value of the kind.
       */
      static fromValue(value) {
        switch (value) {
          case "comment":
            return _$WE.Comment;
          case "imports":
            return _$WE.Imports;
          case "region":
            return _$WE.Region;
        }
        return new _$WE(value);
      }
      /**
       * Creates a new {@link $WE}.
       *
       * @param value of the kind.
       */
      constructor(value) {
        this.value = value;
      }
    };
    (function(NewSymbolNameTag3) {
      NewSymbolNameTag3[NewSymbolNameTag3["AIGenerated"] = 1] = "AIGenerated";
    })(NewSymbolNameTag2 || (NewSymbolNameTag2 = {}));
    (function(NewSymbolNameTriggerKind3) {
      NewSymbolNameTriggerKind3[NewSymbolNameTriggerKind3["Invoke"] = 0] = "Invoke";
      NewSymbolNameTriggerKind3[NewSymbolNameTriggerKind3["Automatic"] = 1] = "Automatic";
    })(NewSymbolNameTriggerKind2 || (NewSymbolNameTriggerKind2 = {}));
    (function(Command2) {
      function is(obj) {
        if (!obj || typeof obj !== "object") {
          return false;
        }
        return typeof obj.id === "string" && typeof obj.title === "string";
      }
      Command2.is = is;
    })(Command || (Command = {}));
    (function(CommentThreadCollapsibleState3) {
      CommentThreadCollapsibleState3[CommentThreadCollapsibleState3["Collapsed"] = 0] = "Collapsed";
      CommentThreadCollapsibleState3[CommentThreadCollapsibleState3["Expanded"] = 1] = "Expanded";
    })(CommentThreadCollapsibleState2 || (CommentThreadCollapsibleState2 = {}));
    (function(CommentThreadState3) {
      CommentThreadState3[CommentThreadState3["Unresolved"] = 0] = "Unresolved";
      CommentThreadState3[CommentThreadState3["Resolved"] = 1] = "Resolved";
    })(CommentThreadState2 || (CommentThreadState2 = {}));
    (function(CommentThreadApplicability3) {
      CommentThreadApplicability3[CommentThreadApplicability3["Current"] = 0] = "Current";
      CommentThreadApplicability3[CommentThreadApplicability3["Outdated"] = 1] = "Outdated";
    })(CommentThreadApplicability2 || (CommentThreadApplicability2 = {}));
    (function(CommentMode3) {
      CommentMode3[CommentMode3["Editing"] = 0] = "Editing";
      CommentMode3[CommentMode3["Preview"] = 1] = "Preview";
    })(CommentMode2 || (CommentMode2 = {}));
    (function(CommentState3) {
      CommentState3[CommentState3["Published"] = 0] = "Published";
      CommentState3[CommentState3["Draft"] = 1] = "Draft";
    })(CommentState2 || (CommentState2 = {}));
    (function(InlayHintKind4) {
      InlayHintKind4[InlayHintKind4["Type"] = 1] = "Type";
      InlayHintKind4[InlayHintKind4["Parameter"] = 2] = "Parameter";
    })(InlayHintKind2 || (InlayHintKind2 = {}));
    $YE = new $sE();
    $ZE = new $sE();
    (function(ExternalUriOpenerPriority3) {
      ExternalUriOpenerPriority3[ExternalUriOpenerPriority3["None"] = 0] = "None";
      ExternalUriOpenerPriority3[ExternalUriOpenerPriority3["Option"] = 1] = "Option";
      ExternalUriOpenerPriority3[ExternalUriOpenerPriority3["Default"] = 2] = "Default";
      ExternalUriOpenerPriority3[ExternalUriOpenerPriority3["Preferred"] = 3] = "Preferred";
    })(ExternalUriOpenerPriority2 || (ExternalUriOpenerPriority2 = {}));
    (function(InlineEditTriggerKind3) {
      InlineEditTriggerKind3[InlineEditTriggerKind3["Invoke"] = 0] = "Invoke";
      InlineEditTriggerKind3[InlineEditTriggerKind3["Automatic"] = 1] = "Automatic";
    })(InlineEditTriggerKind2 || (InlineEditTriggerKind2 = {}));
  }
});

// out-build/vs/platform/markers/common/markers.js
var MarkerTag, MarkerSeverity, IMarkerData, $DE;
var init_markers = __esm({
  "out-build/vs/platform/markers/common/markers.js"() {
    "use strict";
    init_severity();
    init_nls2();
    init_instantiation();
    (function(MarkerTag2) {
      MarkerTag2[MarkerTag2["Unnecessary"] = 1] = "Unnecessary";
      MarkerTag2[MarkerTag2["Deprecated"] = 2] = "Deprecated";
    })(MarkerTag || (MarkerTag = {}));
    (function(MarkerSeverity2) {
      MarkerSeverity2[MarkerSeverity2["Hint"] = 1] = "Hint";
      MarkerSeverity2[MarkerSeverity2["Info"] = 2] = "Info";
      MarkerSeverity2[MarkerSeverity2["Warning"] = 4] = "Warning";
      MarkerSeverity2[MarkerSeverity2["Error"] = 8] = "Error";
    })(MarkerSeverity || (MarkerSeverity = {}));
    (function(MarkerSeverity2) {
      function compare3(a, b) {
        return b - a;
      }
      MarkerSeverity2.compare = compare3;
      const _displayStrings = /* @__PURE__ */ Object.create(null);
      _displayStrings[MarkerSeverity2.Error] = localize(1998, null);
      _displayStrings[MarkerSeverity2.Warning] = localize(1999, null);
      _displayStrings[MarkerSeverity2.Info] = localize(2e3, null);
      function toString(a) {
        return _displayStrings[a] || "";
      }
      MarkerSeverity2.toString = toString;
      function fromSeverity(severity) {
        switch (severity) {
          case severity_default.Error:
            return MarkerSeverity2.Error;
          case severity_default.Warning:
            return MarkerSeverity2.Warning;
          case severity_default.Info:
            return MarkerSeverity2.Info;
          case severity_default.Ignore:
            return MarkerSeverity2.Hint;
        }
      }
      MarkerSeverity2.fromSeverity = fromSeverity;
      function toSeverity(severity) {
        switch (severity) {
          case MarkerSeverity2.Error:
            return severity_default.Error;
          case MarkerSeverity2.Warning:
            return severity_default.Warning;
          case MarkerSeverity2.Info:
            return severity_default.Info;
          case MarkerSeverity2.Hint:
            return severity_default.Ignore;
        }
      }
      MarkerSeverity2.toSeverity = toSeverity;
    })(MarkerSeverity || (MarkerSeverity = {}));
    (function(IMarkerData2) {
      const emptyString = "";
      function makeKey(markerData) {
        return makeKeyOptionalMessage(markerData, true);
      }
      IMarkerData2.makeKey = makeKey;
      function makeKeyOptionalMessage(markerData, useMessage) {
        const result = [emptyString];
        if (markerData.source) {
          result.push(markerData.source.replace("\xA6", "\\\xA6"));
        } else {
          result.push(emptyString);
        }
        if (markerData.code) {
          if (typeof markerData.code === "string") {
            result.push(markerData.code.replace("\xA6", "\\\xA6"));
          } else {
            result.push(markerData.code.value.replace("\xA6", "\\\xA6"));
          }
        } else {
          result.push(emptyString);
        }
        if (markerData.severity !== void 0 && markerData.severity !== null) {
          result.push(MarkerSeverity.toString(markerData.severity));
        } else {
          result.push(emptyString);
        }
        if (markerData.message && useMessage) {
          result.push(markerData.message.replace("\xA6", "\\\xA6"));
        } else {
          result.push(emptyString);
        }
        if (markerData.startLineNumber !== void 0 && markerData.startLineNumber !== null) {
          result.push(markerData.startLineNumber.toString());
        } else {
          result.push(emptyString);
        }
        if (markerData.startColumn !== void 0 && markerData.startColumn !== null) {
          result.push(markerData.startColumn.toString());
        } else {
          result.push(emptyString);
        }
        if (markerData.endLineNumber !== void 0 && markerData.endLineNumber !== null) {
          result.push(markerData.endLineNumber.toString());
        } else {
          result.push(emptyString);
        }
        if (markerData.endColumn !== void 0 && markerData.endColumn !== null) {
          result.push(markerData.endColumn.toString());
        } else {
          result.push(emptyString);
        }
        result.push(emptyString);
        return result.join("\xA6");
      }
      IMarkerData2.makeKeyOptionalMessage = makeKeyOptionalMessage;
    })(IMarkerData || (IMarkerData = {}));
    $DE = $Qk("markerService");
  }
});

// out-build/vs/base/common/actions.js
var $Um, $Wm, $Ym;
var init_actions = __esm({
  "out-build/vs/base/common/actions.js"() {
    "use strict";
    init_event();
    init_lifecycle();
    init_nls2();
    $Um = class extends $3c {
      constructor(id2, label = "", cssClass = "", enabled = true, actionCallback) {
        super();
        this.j = this.B(new $ze());
        this.onDidChange = this.j.event;
        this.z = true;
        this.m = id2;
        this.n = label;
        this.w = cssClass;
        this.z = enabled;
        this.D = actionCallback;
      }
      get id() {
        return this.m;
      }
      get label() {
        return this.n;
      }
      set label(value) {
        this.F(value);
      }
      F(value) {
        if (this.n !== value) {
          this.n = value;
          this.j.fire({ label: value });
        }
      }
      get tooltip() {
        return this.u || "";
      }
      set tooltip(value) {
        this.G(value);
      }
      G(value) {
        if (this.u !== value) {
          this.u = value;
          this.j.fire({ tooltip: value });
        }
      }
      get class() {
        return this.w;
      }
      set class(value) {
        this.H(value);
      }
      H(value) {
        if (this.w !== value) {
          this.w = value;
          this.j.fire({ class: value });
        }
      }
      get enabled() {
        return this.z;
      }
      set enabled(value) {
        this.I(value);
      }
      I(value) {
        if (this.z !== value) {
          this.z = value;
          this.j.fire({ enabled: value });
        }
      }
      get checked() {
        return this.C;
      }
      set checked(value) {
        this.J(value);
      }
      J(value) {
        if (this.C !== value) {
          this.C = value;
          this.j.fire({ checked: value });
        }
      }
      async run(event, data) {
        if (this.D) {
          await this.D(event);
        }
      }
    };
    $Wm = class _$Wm {
      constructor() {
        this.id = _$Wm.ID;
        this.label = "";
        this.tooltip = "";
        this.class = "separator";
        this.enabled = false;
        this.checked = false;
      }
      /**
       * Joins all non-empty lists of actions with separators.
       */
      static join(...actionLists) {
        let out = [];
        for (const list2 of actionLists) {
          if (!list2.length) {
          } else if (out.length) {
            out = [...out, new _$Wm(), ...list2];
          } else {
            out = list2;
          }
        }
        return out;
      }
      static {
        this.ID = "vs.actions.separator";
      }
      async run() {
      }
    };
    $Ym = class _$Ym extends $Um {
      static {
        this.ID = "vs.actions.empty";
      }
      constructor() {
        super(_$Ym.ID, localize(44, null), void 0, false);
      }
    };
  }
});

// out-build/vs/workbench/common/editor.js
function $9K(editor) {
  if ($dL(editor)) {
    return false;
  }
  const candidate = editor;
  return candidate?.original !== void 0 && candidate.modified !== void 0;
}
function $0K(editor) {
  if ($dL(editor)) {
    return false;
  }
  const candidate = editor;
  if (!candidate) {
    return false;
  }
  if (candidate.resources && !Array.isArray(candidate.resources)) {
    return false;
  }
  return !!candidate.resources || !!candidate.multiDiffSource;
}
function $$K(editor) {
  if ($dL(editor)) {
    return false;
  }
  if ($9K(editor)) {
    return false;
  }
  const candidate = editor;
  return candidate?.primary !== void 0 && candidate.secondary !== void 0;
}
function $aL(editor) {
  if ($dL(editor)) {
    return false;
  }
  const candidate = editor;
  return URI.isUri(candidate?.base?.resource) && URI.isUri(candidate?.input1?.resource) && URI.isUri(candidate?.input2?.resource) && URI.isUri(candidate?.result?.resource);
}
function $dL(editor) {
  return editor instanceof $cL;
}
function isEditorInputWithPreferredResource(editor) {
  const candidate = editor;
  return URI.isUri(candidate?.preferredResource);
}
function $eL(editor) {
  const candidate = editor;
  return $dL(candidate?.primary) && $dL(candidate?.secondary);
}
function $fL(editor) {
  const candidate = editor;
  return $dL(candidate?.modified) && $dL(candidate?.original);
}
var $ZK, $1K, EditorPaneSelectionChangeReason, EditorPaneSelectionCompareResult, Verbosity, SaveReason, SaveSourceFactory, $bL, EditorInputCapabilities, $cL, EditorCloseContext, GroupModelChangeKind, SideBySideEditor, EditorResourceAccessorImpl, EditorCloseMethod, $mL, CloseDirection, EditorFactoryRegistry, EditorsOrder;
var init_editor = __esm({
  "out-build/vs/workbench/common/editor.js"() {
    "use strict";
    init_nls2();
    init_types();
    init_uri();
    init_lifecycle();
    init_instantiation();
    init_platform2();
    init_files();
    init_network();
    init_errorMessage();
    init_actions();
    init_severity();
    $ZK = {
      EditorPane: "workbench.contributions.editors",
      EditorFactory: "workbench.contributions.editor.inputFactories"
    };
    $1K = {
      id: "default",
      displayName: localize(4133, null),
      providerDisplayName: localize(4134, null)
    };
    (function(EditorPaneSelectionChangeReason2) {
      EditorPaneSelectionChangeReason2[EditorPaneSelectionChangeReason2["PROGRAMMATIC"] = 1] = "PROGRAMMATIC";
      EditorPaneSelectionChangeReason2[EditorPaneSelectionChangeReason2["USER"] = 2] = "USER";
      EditorPaneSelectionChangeReason2[EditorPaneSelectionChangeReason2["EDIT"] = 3] = "EDIT";
      EditorPaneSelectionChangeReason2[EditorPaneSelectionChangeReason2["NAVIGATION"] = 4] = "NAVIGATION";
      EditorPaneSelectionChangeReason2[EditorPaneSelectionChangeReason2["JUMP"] = 5] = "JUMP";
    })(EditorPaneSelectionChangeReason || (EditorPaneSelectionChangeReason = {}));
    (function(EditorPaneSelectionCompareResult2) {
      EditorPaneSelectionCompareResult2[EditorPaneSelectionCompareResult2["IDENTICAL"] = 1] = "IDENTICAL";
      EditorPaneSelectionCompareResult2[EditorPaneSelectionCompareResult2["SIMILAR"] = 2] = "SIMILAR";
      EditorPaneSelectionCompareResult2[EditorPaneSelectionCompareResult2["DIFFERENT"] = 3] = "DIFFERENT";
    })(EditorPaneSelectionCompareResult || (EditorPaneSelectionCompareResult = {}));
    (function(Verbosity3) {
      Verbosity3[Verbosity3["SHORT"] = 0] = "SHORT";
      Verbosity3[Verbosity3["MEDIUM"] = 1] = "MEDIUM";
      Verbosity3[Verbosity3["LONG"] = 2] = "LONG";
    })(Verbosity || (Verbosity = {}));
    (function(SaveReason2) {
      SaveReason2[SaveReason2["EXPLICIT"] = 1] = "EXPLICIT";
      SaveReason2[SaveReason2["AUTO"] = 2] = "AUTO";
      SaveReason2[SaveReason2["FOCUS_CHANGE"] = 3] = "FOCUS_CHANGE";
      SaveReason2[SaveReason2["WINDOW_CHANGE"] = 4] = "WINDOW_CHANGE";
    })(SaveReason || (SaveReason = {}));
    SaveSourceFactory = class {
      constructor() {
        this.a = /* @__PURE__ */ new Map();
      }
      /**
       * Registers a `SaveSource` with an identifier and label
       * to the registry so that it can be used in save operations.
       */
      registerSource(id2, label) {
        let sourceDescriptor = this.a.get(id2);
        if (!sourceDescriptor) {
          sourceDescriptor = { source: id2, label };
          this.a.set(id2, sourceDescriptor);
        }
        return sourceDescriptor.source;
      }
      getSourceLabel(source) {
        return this.a.get(source)?.label ?? source;
      }
    };
    $bL = new SaveSourceFactory();
    (function(EditorInputCapabilities2) {
      EditorInputCapabilities2[EditorInputCapabilities2["None"] = 0] = "None";
      EditorInputCapabilities2[EditorInputCapabilities2["Readonly"] = 2] = "Readonly";
      EditorInputCapabilities2[EditorInputCapabilities2["Untitled"] = 4] = "Untitled";
      EditorInputCapabilities2[EditorInputCapabilities2["Singleton"] = 8] = "Singleton";
      EditorInputCapabilities2[EditorInputCapabilities2["RequiresTrust"] = 16] = "RequiresTrust";
      EditorInputCapabilities2[EditorInputCapabilities2["CanSplitInGroup"] = 32] = "CanSplitInGroup";
      EditorInputCapabilities2[EditorInputCapabilities2["ForceDescription"] = 64] = "ForceDescription";
      EditorInputCapabilities2[EditorInputCapabilities2["CanDropIntoEditor"] = 128] = "CanDropIntoEditor";
      EditorInputCapabilities2[EditorInputCapabilities2["MultipleEditors"] = 256] = "MultipleEditors";
      EditorInputCapabilities2[EditorInputCapabilities2["Scratchpad"] = 512] = "Scratchpad";
    })(EditorInputCapabilities || (EditorInputCapabilities = {}));
    $cL = class extends $3c {
    };
    (function(EditorCloseContext2) {
      EditorCloseContext2[EditorCloseContext2["UNKNOWN"] = 0] = "UNKNOWN";
      EditorCloseContext2[EditorCloseContext2["REPLACE"] = 1] = "REPLACE";
      EditorCloseContext2[EditorCloseContext2["MOVE"] = 2] = "MOVE";
      EditorCloseContext2[EditorCloseContext2["UNPIN"] = 3] = "UNPIN";
    })(EditorCloseContext || (EditorCloseContext = {}));
    (function(GroupModelChangeKind2) {
      GroupModelChangeKind2[GroupModelChangeKind2["GROUP_ACTIVE"] = 0] = "GROUP_ACTIVE";
      GroupModelChangeKind2[GroupModelChangeKind2["GROUP_INDEX"] = 1] = "GROUP_INDEX";
      GroupModelChangeKind2[GroupModelChangeKind2["GROUP_LABEL"] = 2] = "GROUP_LABEL";
      GroupModelChangeKind2[GroupModelChangeKind2["GROUP_LOCKED"] = 3] = "GROUP_LOCKED";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITORS_SELECTION"] = 4] = "EDITORS_SELECTION";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_OPEN"] = 5] = "EDITOR_OPEN";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_CLOSE"] = 6] = "EDITOR_CLOSE";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_MOVE"] = 7] = "EDITOR_MOVE";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_ACTIVE"] = 8] = "EDITOR_ACTIVE";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_LABEL"] = 9] = "EDITOR_LABEL";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_CAPABILITIES"] = 10] = "EDITOR_CAPABILITIES";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_PIN"] = 11] = "EDITOR_PIN";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_TRANSIENT"] = 12] = "EDITOR_TRANSIENT";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_STICKY"] = 13] = "EDITOR_STICKY";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_DIRTY"] = 14] = "EDITOR_DIRTY";
      GroupModelChangeKind2[GroupModelChangeKind2["EDITOR_WILL_DISPOSE"] = 15] = "EDITOR_WILL_DISPOSE";
    })(GroupModelChangeKind || (GroupModelChangeKind = {}));
    (function(SideBySideEditor2) {
      SideBySideEditor2[SideBySideEditor2["PRIMARY"] = 1] = "PRIMARY";
      SideBySideEditor2[SideBySideEditor2["SECONDARY"] = 2] = "SECONDARY";
      SideBySideEditor2[SideBySideEditor2["BOTH"] = 3] = "BOTH";
      SideBySideEditor2[SideBySideEditor2["ANY"] = 4] = "ANY";
    })(SideBySideEditor || (SideBySideEditor = {}));
    EditorResourceAccessorImpl = class {
      getOriginalUri(editor, options2) {
        if (!editor) {
          return void 0;
        }
        if ($aL(editor)) {
          return $mL.getOriginalUri(editor.result, options2);
        }
        if (options2?.supportSideBySide) {
          const { primary, secondary } = this.a(editor);
          if (primary && secondary) {
            if (options2?.supportSideBySide === SideBySideEditor.BOTH) {
              return {
                primary: this.getOriginalUri(primary, { filterByScheme: options2.filterByScheme }),
                secondary: this.getOriginalUri(secondary, { filterByScheme: options2.filterByScheme })
              };
            } else if (options2?.supportSideBySide === SideBySideEditor.ANY) {
              return this.getOriginalUri(primary, { filterByScheme: options2.filterByScheme }) ?? this.getOriginalUri(secondary, { filterByScheme: options2.filterByScheme });
            }
            editor = options2.supportSideBySide === SideBySideEditor.PRIMARY ? primary : secondary;
          }
        }
        if ($9K(editor) || $0K(editor) || $$K(editor) || $aL(editor)) {
          return void 0;
        }
        const originalResource = isEditorInputWithPreferredResource(editor) ? editor.preferredResource : editor.resource;
        if (!originalResource || !options2 || !options2.filterByScheme) {
          return originalResource;
        }
        return this.b(originalResource, options2.filterByScheme);
      }
      a(editor) {
        if ($eL(editor) || $$K(editor)) {
          return { primary: editor.primary, secondary: editor.secondary };
        }
        if ($fL(editor) || $9K(editor)) {
          return { primary: editor.modified, secondary: editor.original };
        }
        return { primary: void 0, secondary: void 0 };
      }
      getCanonicalUri(editor, options2) {
        if (!editor) {
          return void 0;
        }
        if ($aL(editor)) {
          return $mL.getCanonicalUri(editor.result, options2);
        }
        if (options2?.supportSideBySide) {
          const { primary, secondary } = this.a(editor);
          if (primary && secondary) {
            if (options2?.supportSideBySide === SideBySideEditor.BOTH) {
              return {
                primary: this.getCanonicalUri(primary, { filterByScheme: options2.filterByScheme }),
                secondary: this.getCanonicalUri(secondary, { filterByScheme: options2.filterByScheme })
              };
            } else if (options2?.supportSideBySide === SideBySideEditor.ANY) {
              return this.getCanonicalUri(primary, { filterByScheme: options2.filterByScheme }) ?? this.getCanonicalUri(secondary, { filterByScheme: options2.filterByScheme });
            }
            editor = options2.supportSideBySide === SideBySideEditor.PRIMARY ? primary : secondary;
          }
        }
        if ($9K(editor) || $0K(editor) || $$K(editor) || $aL(editor)) {
          return void 0;
        }
        const canonicalResource = editor.resource;
        if (!canonicalResource || !options2 || !options2.filterByScheme) {
          return canonicalResource;
        }
        return this.b(canonicalResource, options2.filterByScheme);
      }
      b(resource, filter) {
        if (Array.isArray(filter)) {
          if (filter.some((scheme) => resource.scheme === scheme)) {
            return resource;
          }
        } else {
          if (filter === resource.scheme) {
            return resource;
          }
        }
        return void 0;
      }
    };
    (function(EditorCloseMethod2) {
      EditorCloseMethod2[EditorCloseMethod2["UNKNOWN"] = 0] = "UNKNOWN";
      EditorCloseMethod2[EditorCloseMethod2["KEYBOARD"] = 1] = "KEYBOARD";
      EditorCloseMethod2[EditorCloseMethod2["MOUSE"] = 2] = "MOUSE";
    })(EditorCloseMethod || (EditorCloseMethod = {}));
    $mL = new EditorResourceAccessorImpl();
    (function(CloseDirection2) {
      CloseDirection2[CloseDirection2["LEFT"] = 0] = "LEFT";
      CloseDirection2[CloseDirection2["RIGHT"] = 1] = "RIGHT";
    })(CloseDirection || (CloseDirection = {}));
    EditorFactoryRegistry = class {
      constructor() {
        this.c = /* @__PURE__ */ new Map();
        this.d = /* @__PURE__ */ new Map();
      }
      start(accessor) {
        const instantiationService = this.a = accessor.get($Pk);
        for (const [key, ctor] of this.c) {
          this.e(key, ctor, instantiationService);
        }
        this.c.clear();
      }
      e(editorTypeId, ctor, instantiationService) {
        const instance = instantiationService.createInstance(ctor);
        this.d.set(editorTypeId, instance);
      }
      registerFileEditorFactory(factory) {
        if (this.b) {
          throw new Error("Can only register one file editor factory.");
        }
        this.b = factory;
      }
      getFileEditorFactory() {
        return $Kg(this.b);
      }
      registerEditorSerializer(editorTypeId, ctor) {
        if (this.c.has(editorTypeId) || this.d.has(editorTypeId)) {
          throw new Error(`A editor serializer with type ID '${editorTypeId}' was already registered.`);
        }
        if (!this.a) {
          this.c.set(editorTypeId, ctor);
        } else {
          this.e(editorTypeId, ctor, this.a);
        }
        return $1c(() => {
          this.c.delete(editorTypeId);
          this.d.delete(editorTypeId);
        });
      }
      getEditorSerializer(arg1) {
        return this.d.get(typeof arg1 === "string" ? arg1 : arg1.typeId);
      }
    };
    $Wn.add($ZK.EditorFactory, new EditorFactoryRegistry());
    (function(EditorsOrder2) {
      EditorsOrder2[EditorsOrder2["MOST_RECENTLY_ACTIVE"] = 0] = "MOST_RECENTLY_ACTIVE";
      EditorsOrder2[EditorsOrder2["SEQUENTIAL"] = 1] = "SEQUENTIAL";
    })(EditorsOrder || (EditorsOrder = {}));
  }
});

// out-build/vs/base/common/observableInternal/debugName.js
function $ed(target, data) {
  const cached = cachedDebugName.get(target);
  if (cached) {
    return cached;
  }
  const dbgName = computeDebugName(target, data);
  if (dbgName) {
    let count = countPerName.get(dbgName) ?? 0;
    count++;
    countPerName.set(dbgName, count);
    const result = count === 1 ? dbgName : `${dbgName}#${count}`;
    cachedDebugName.set(target, result);
    return result;
  }
  return void 0;
}
function computeDebugName(self2, data) {
  const cached = cachedDebugName.get(self2);
  if (cached) {
    return cached;
  }
  const ownerStr = data.owner ? formatOwner(data.owner) + `.` : "";
  let result;
  const debugNameSource = data.debugNameSource;
  if (debugNameSource !== void 0) {
    if (typeof debugNameSource === "function") {
      result = debugNameSource();
      if (result !== void 0) {
        return ownerStr + result;
      }
    } else {
      return ownerStr + debugNameSource;
    }
  }
  const referenceFn = data.referenceFn;
  if (referenceFn !== void 0) {
    result = $fd(referenceFn);
    if (result !== void 0) {
      return ownerStr + result;
    }
  }
  if (data.owner !== void 0) {
    const key = findKey(data.owner, self2);
    if (key !== void 0) {
      return ownerStr + key;
    }
  }
  return void 0;
}
function findKey(obj, value) {
  for (const key in obj) {
    if (obj[key] === value) {
      return key;
    }
  }
  return void 0;
}
function formatOwner(owner) {
  const id2 = ownerId.get(owner);
  if (id2) {
    return id2;
  }
  const className = getClassName(owner);
  let count = countPerClassName.get(className) ?? 0;
  count++;
  countPerClassName.set(className, count);
  const result = count === 1 ? className : `${className}#${count}`;
  ownerId.set(owner, result);
  return result;
}
function getClassName(obj) {
  const ctor = obj.constructor;
  if (ctor) {
    return ctor.name;
  }
  return "Object";
}
function $fd(fn) {
  const fnSrc = fn.toString();
  const regexp = /\/\*\*\s*@description\s*([^*]*)\*\//;
  const match = regexp.exec(fnSrc);
  const result = match ? match[1] : void 0;
  return result?.trim();
}
var $dd, countPerName, cachedDebugName, countPerClassName, ownerId;
var init_debugName = __esm({
  "out-build/vs/base/common/observableInternal/debugName.js"() {
    "use strict";
    $dd = class {
      constructor(owner, debugNameSource, referenceFn) {
        this.owner = owner;
        this.debugNameSource = debugNameSource;
        this.referenceFn = referenceFn;
      }
      getDebugName(target) {
        return $ed(target, this);
      }
    };
    countPerName = /* @__PURE__ */ new Map();
    cachedDebugName = /* @__PURE__ */ new WeakMap();
    countPerClassName = /* @__PURE__ */ new Map();
    ownerId = /* @__PURE__ */ new WeakMap();
  }
});

// out-build/vs/base/common/equals.js
var $md;
var init_equals = __esm({
  "out-build/vs/base/common/equals.js"() {
    "use strict";
    init_arrays();
    $md = (a, b) => a === b;
  }
});

// out-build/vs/base/common/observableInternal/commonFacade/deps.js
var init_deps = __esm({
  "out-build/vs/base/common/observableInternal/commonFacade/deps.js"() {
    "use strict";
    init_assert();
    init_equals();
    init_errors();
    init_event();
    init_lifecycle();
  }
});

// out-build/vs/base/common/observableInternal/logging.js
function $Yd(logger) {
  globalObservableLogger = logger;
}
function $Zd() {
  return globalObservableLogger;
}
function consoleTextToArgs(text) {
  const styles = new Array();
  const data = [];
  let firstArg = "";
  function process2(t) {
    if ("length" in t) {
      for (const item of t) {
        if (item) {
          process2(item);
        }
      }
    } else if ("text" in t) {
      firstArg += `%c${t.text}`;
      styles.push(t.style);
      if (t.data) {
        data.push(...t.data);
      }
    } else if ("data" in t) {
      data.push(...t.data);
    }
  }
  process2(text);
  const result = [firstArg, ...styles];
  result.push(...data);
  return result;
}
function normalText(text) {
  return styled(text, { color: "black" });
}
function formatKind(kind) {
  return styled(padStr(`${kind}: `, 10), { color: "black", bold: true });
}
function styled(text, options2 = {
  color: "black"
}) {
  function objToCss(styleObj) {
    return Object.entries(styleObj).reduce((styleString, [propName, propValue]) => {
      return `${styleString}${propName}:${propValue};`;
    }, "");
  }
  const style = {
    color: options2.color
  };
  if (options2.strikeThrough) {
    style["text-decoration"] = "line-through";
  }
  if (options2.bold) {
    style["font-weight"] = "bold";
  }
  return {
    text,
    style: objToCss(style)
  };
}
function formatValue(value, availableLen) {
  switch (typeof value) {
    case "number":
      return "" + value;
    case "string":
      if (value.length + 2 <= availableLen) {
        return `"${value}"`;
      }
      return `"${value.substr(0, availableLen - 7)}"+...`;
    case "boolean":
      return value ? "true" : "false";
    case "undefined":
      return "undefined";
    case "object":
      if (value === null) {
        return "null";
      }
      if (Array.isArray(value)) {
        return formatArray(value, availableLen);
      }
      return formatObject(value, availableLen);
    case "symbol":
      return value.toString();
    case "function":
      return `[[Function${value.name ? " " + value.name : ""}]]`;
    default:
      return "" + value;
  }
}
function formatArray(value, availableLen) {
  let result = "[ ";
  let first = true;
  for (const val of value) {
    if (!first) {
      result += ", ";
    }
    if (result.length - 5 > availableLen) {
      result += "...";
      break;
    }
    first = false;
    result += `${formatValue(val, availableLen - result.length)}`;
  }
  result += " ]";
  return result;
}
function formatObject(value, availableLen) {
  let result = "{ ";
  let first = true;
  for (const [key, val] of Object.entries(value)) {
    if (!first) {
      result += ", ";
    }
    if (result.length - 5 > availableLen) {
      result += "...";
      break;
    }
    first = false;
    result += `${key}: ${formatValue(val, availableLen - result.length)}`;
  }
  result += " }";
  return result;
}
function repeat2(str, count) {
  let result = "";
  for (let i = 1; i <= count; i++) {
    result += str;
  }
  return result;
}
function padStr(str, length) {
  while (str.length < length) {
    str += " ";
  }
  return str;
}
var globalObservableLogger, $1d;
var init_logging = __esm({
  "out-build/vs/base/common/observableInternal/logging.js"() {
    "use strict";
    $1d = class {
      constructor() {
        this.a = 0;
        this.d = /* @__PURE__ */ new WeakMap();
      }
      b(text) {
        return consoleTextToArgs([
          normalText(repeat2("|  ", this.a)),
          text
        ]);
      }
      c(info) {
        if (!info.hadValue) {
          return [
            normalText(` `),
            styled(formatValue(info.newValue, 60), {
              color: "green"
            }),
            normalText(` (initial)`)
          ];
        }
        return info.didChange ? [
          normalText(` `),
          styled(formatValue(info.oldValue, 70), {
            color: "red",
            strikeThrough: true
          }),
          normalText(` `),
          styled(formatValue(info.newValue, 60), {
            color: "green"
          })
        ] : [normalText(` (unchanged)`)];
      }
      handleObservableChanged(observable, info) {
        console.log(...this.b([
          formatKind("observable value changed"),
          styled(observable.debugName, { color: "BlueViolet" }),
          ...this.c(info)
        ]));
      }
      formatChanges(changes) {
        if (changes.size === 0) {
          return void 0;
        }
        return styled(" (changed deps: " + [...changes].map((o) => o.debugName).join(", ") + ")", { color: "gray" });
      }
      handleDerivedCreated(derived) {
        const existingHandleChange = derived.handleChange;
        this.d.set(derived, /* @__PURE__ */ new Set());
        derived.handleChange = (observable, change) => {
          this.d.get(derived).add(observable);
          return existingHandleChange.apply(derived, [observable, change]);
        };
      }
      handleDerivedRecomputed(derived, info) {
        const changedObservables = this.d.get(derived);
        console.log(...this.b([
          formatKind("derived recomputed"),
          styled(derived.debugName, { color: "BlueViolet" }),
          ...this.c(info),
          this.formatChanges(changedObservables),
          { data: [{ fn: derived._debugNameData.referenceFn ?? derived._computeFn }] }
        ]));
        changedObservables.clear();
      }
      handleFromEventObservableTriggered(observable, info) {
        console.log(...this.b([
          formatKind("observable from event triggered"),
          styled(observable.debugName, { color: "BlueViolet" }),
          ...this.c(info),
          { data: [{ fn: observable._getValue }] }
        ]));
      }
      handleAutorunCreated(autorun) {
        const existingHandleChange = autorun.handleChange;
        this.d.set(autorun, /* @__PURE__ */ new Set());
        autorun.handleChange = (observable, change) => {
          this.d.get(autorun).add(observable);
          return existingHandleChange.apply(autorun, [observable, change]);
        };
      }
      handleAutorunTriggered(autorun) {
        const changedObservables = this.d.get(autorun);
        console.log(...this.b([
          formatKind("autorun"),
          styled(autorun.debugName, { color: "BlueViolet" }),
          this.formatChanges(changedObservables),
          { data: [{ fn: autorun._debugNameData.referenceFn ?? autorun._runFn }] }
        ]));
        changedObservables.clear();
        this.a++;
      }
      handleAutorunFinished(autorun) {
        this.a--;
      }
      handleBeginTransaction(transaction) {
        let transactionName = transaction.getDebugName();
        if (transactionName === void 0) {
          transactionName = "";
        }
        console.log(...this.b([
          formatKind("transaction"),
          styled(transactionName, { color: "BlueViolet" }),
          { data: [{ fn: transaction._fn }] }
        ]));
        this.a++;
      }
      handleEndTransaction() {
        this.a--;
      }
    };
  }
});

// out-build/vs/base/common/observableInternal/base.js
function $0d(recomputeInitiallyAndOnChange) {
  _recomputeInitiallyAndOnChange = recomputeInitiallyAndOnChange;
}
function $$d(keepObserved) {
  _keepObserved = keepObserved;
}
function $_d(derived) {
  _derived = derived;
}
function $ce(fn, getDebugName) {
  const tx = new $ge(fn, getDebugName);
  try {
    fn(tx);
  } finally {
    tx.finish();
  }
}
function $fe(tx, fn, getDebugName) {
  if (!tx) {
    $ce(fn, getDebugName);
  } else {
    fn(tx);
  }
}
function $he(nameOrOwner, initialValue) {
  let debugNameData;
  if (typeof nameOrOwner === "string") {
    debugNameData = new $dd(void 0, nameOrOwner, void 0);
  } else {
    debugNameData = new $dd(nameOrOwner, void 0, void 0);
  }
  return new $ie(debugNameData, initialValue, $md);
}
var _recomputeInitiallyAndOnChange, _keepObserved, _derived, $ae, $be, $ge, $ie;
var init_base = __esm({
  "out-build/vs/base/common/observableInternal/base.js"() {
    "use strict";
    init_debugName();
    init_deps();
    init_logging();
    $ae = class {
      get TChange() {
        return null;
      }
      reportChanges() {
        this.get();
      }
      /** @sealed */
      read(reader) {
        if (reader) {
          return reader.readObservable(this);
        } else {
          return this.get();
        }
      }
      map(fnOrOwner, fnOrUndefined) {
        const owner = fnOrUndefined === void 0 ? void 0 : fnOrOwner;
        const fn = fnOrUndefined === void 0 ? fnOrOwner : fnOrUndefined;
        return _derived({
          owner,
          debugName: () => {
            const name = $fd(fn);
            if (name !== void 0) {
              return name;
            }
            const regexp = /^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/;
            const match = regexp.exec(fn.toString());
            if (match) {
              return `${this.debugName}.${match[2]}`;
            }
            if (!owner) {
              return `${this.debugName} (mapped)`;
            }
            return void 0;
          },
          debugReferenceFn: fn
        }, (reader) => fn(this.read(reader), reader));
      }
      /**
       * @sealed
       * Converts an observable of an observable value into a direct observable of the value.
      */
      flatten() {
        return _derived({
          owner: void 0,
          debugName: () => `${this.debugName} (flattened)`
        }, (reader) => this.read(reader).read(reader));
      }
      recomputeInitiallyAndOnChange(store, handleValue) {
        store.add(_recomputeInitiallyAndOnChange(this, handleValue));
        return this;
      }
      /**
       * Ensures that this observable is observed. This keeps the cache alive.
       * However, in case of deriveds, it does not force eager evaluation (only when the value is read/get).
       * Use `recomputeInitiallyAndOnChange` for eager evaluation.
       */
      keepObserved(store) {
        store.add(_keepObserved(this));
        return this;
      }
      get a() {
        return this.get();
      }
    };
    $be = class extends $ae {
      constructor() {
        super(...arguments);
        this.b = /* @__PURE__ */ new Set();
      }
      addObserver(observer) {
        const len = this.b.size;
        this.b.add(observer);
        if (len === 0) {
          this.c();
        }
      }
      removeObserver(observer) {
        const deleted = this.b.delete(observer);
        if (deleted && this.b.size === 0) {
          this.f();
        }
      }
      c() {
      }
      f() {
      }
    };
    $ge = class {
      constructor(_fn, b) {
        this._fn = _fn;
        this.b = b;
        this.a = [];
        $Zd()?.handleBeginTransaction(this);
      }
      getDebugName() {
        if (this.b) {
          return this.b();
        }
        return $fd(this._fn);
      }
      updateObserver(observer, observable) {
        this.a.push({ observer, observable });
        observer.beginUpdate(observable);
      }
      finish() {
        const updatingObservers = this.a;
        for (let i = 0; i < updatingObservers.length; i++) {
          const { observer, observable } = updatingObservers[i];
          observer.endUpdate(observable);
        }
        this.a = null;
        $Zd()?.handleEndTransaction();
      }
    };
    $ie = class extends $be {
      get debugName() {
        return this.e.getDebugName(this) ?? "ObservableValue";
      }
      constructor(e, initialValue, g) {
        super();
        this.e = e;
        this.g = g;
        this.d = initialValue;
      }
      get() {
        return this.d;
      }
      set(value, tx, change) {
        if (change === void 0 && this.g(this.d, value)) {
          return;
        }
        let _tx;
        if (!tx) {
          tx = _tx = new $ge(() => {
          }, () => `Setting ${this.debugName}`);
        }
        try {
          const oldValue = this.d;
          this.h(value);
          $Zd()?.handleObservableChanged(this, { oldValue, newValue: value, change, didChange: true, hadValue: true });
          for (const observer of this.b) {
            tx.updateObserver(observer, this);
            observer.handleChange(this, change);
          }
        } finally {
          if (_tx) {
            _tx.finish();
          }
        }
      }
      toString() {
        return `${this.debugName}: ${this.d}`;
      }
      h(newValue) {
        this.d = newValue;
      }
    };
  }
});

// out-build/vs/base/common/observableInternal/lazyObservableValue.js
var init_lazyObservableValue = __esm({
  "out-build/vs/base/common/observableInternal/lazyObservableValue.js"() {
    "use strict";
    init_base();
  }
});

// out-build/vs/base/common/observableInternal/api.js
var init_api = __esm({
  "out-build/vs/base/common/observableInternal/api.js"() {
    "use strict";
    init_base();
    init_debugName();
    init_deps();
    init_lazyObservableValue();
  }
});

// out-build/vs/base/common/observableInternal/autorun.js
function $td(fn) {
  return new $Ad(new $dd(void 0, void 0, fn), fn, void 0, void 0);
}
var AutorunState, $Ad;
var init_autorun = __esm({
  "out-build/vs/base/common/observableInternal/autorun.js"() {
    "use strict";
    init_debugName();
    init_deps();
    init_logging();
    (function(AutorunState2) {
      AutorunState2[AutorunState2["dependenciesMightHaveChanged"] = 1] = "dependenciesMightHaveChanged";
      AutorunState2[AutorunState2["stale"] = 2] = "stale";
      AutorunState2[AutorunState2["upToDate"] = 3] = "upToDate";
    })(AutorunState || (AutorunState = {}));
    $Ad = class {
      get debugName() {
        return this._debugNameData.getDebugName(this) ?? "(anonymous)";
      }
      constructor(_debugNameData, _runFn, i, j) {
        this._debugNameData = _debugNameData;
        this._runFn = _runFn;
        this.i = i;
        this.j = j;
        this.a = 2;
        this.b = 0;
        this.c = false;
        this.f = /* @__PURE__ */ new Set();
        this.g = /* @__PURE__ */ new Set();
        this.l = false;
        this.h = this.i?.();
        $Zd()?.handleAutorunCreated(this);
        this.k();
        $Tc(this);
      }
      dispose() {
        this.c = true;
        for (const o of this.f) {
          o.removeObserver(this);
        }
        this.f.clear();
        $Uc(this);
      }
      k() {
        if (this.a === 3) {
          return;
        }
        const emptySet = this.g;
        this.g = this.f;
        this.f = emptySet;
        this.a = 3;
        const isDisposed = this.c;
        try {
          if (!isDisposed) {
            $Zd()?.handleAutorunTriggered(this);
            const changeSummary = this.h;
            try {
              this.h = this.i?.();
              this.l = true;
              this._runFn(this, changeSummary);
            } catch (e) {
              $fb(e);
            } finally {
              this.l = false;
            }
          }
        } finally {
          if (!isDisposed) {
            $Zd()?.handleAutorunFinished(this);
          }
          for (const o of this.g) {
            o.removeObserver(this);
          }
          this.g.clear();
        }
      }
      toString() {
        return `Autorun<${this.debugName}>`;
      }
      // IObserver implementation
      beginUpdate() {
        if (this.a === 3) {
          this.a = 1;
        }
        this.b++;
      }
      endUpdate() {
        try {
          if (this.b === 1) {
            do {
              if (this.a === 1) {
                this.a = 3;
                for (const d of this.f) {
                  d.reportChanges();
                  if (this.a === 2) {
                    break;
                  }
                }
              }
              this.k();
            } while (this.a !== 3);
          }
        } finally {
          this.b--;
        }
        $kd(() => this.b >= 0);
      }
      handlePossibleChange(observable) {
        if (this.a === 3 && this.f.has(observable) && !this.g.has(observable)) {
          this.a = 1;
        }
      }
      handleChange(observable, change) {
        if (this.f.has(observable) && !this.g.has(observable)) {
          try {
            const shouldReact = this.j ? this.j({
              changedObservable: observable,
              change,
              didChange: (o) => o === observable
            }, this.h) : true;
            if (shouldReact) {
              this.a = 2;
            }
          } catch (e) {
            $fb(e);
          }
        }
      }
      readObservable(observable) {
        if (!this.l) {
          throw new $vb("The reader object cannot be used outside its compute function!");
        }
        if (this.c) {
          return observable.get();
        }
        observable.addObserver(this);
        const value = observable.get();
        this.f.add(observable);
        this.g.delete(observable);
        return value;
      }
    };
    (function($td2) {
      $td2.Observer = $Ad;
    })($td || ($td = {}));
  }
});

// out-build/vs/base/common/observableInternal/derived.js
function $4d(options2, computeFn) {
  return new $8d(new $dd(options2.owner, options2.debugName, options2.debugReferenceFn), computeFn, void 0, void 0, options2.onLastObserverRemoved, options2.equalsFn ?? $md);
}
var DerivedState, $8d;
var init_derived = __esm({
  "out-build/vs/base/common/observableInternal/derived.js"() {
    "use strict";
    init_base();
    init_debugName();
    init_deps();
    init_logging();
    $_d($4d);
    (function(DerivedState2) {
      DerivedState2[DerivedState2["initial"] = 0] = "initial";
      DerivedState2[DerivedState2["dependenciesMightHaveChanged"] = 1] = "dependenciesMightHaveChanged";
      DerivedState2[DerivedState2["stale"] = 2] = "stale";
      DerivedState2[DerivedState2["upToDate"] = 3] = "upToDate";
    })(DerivedState || (DerivedState = {}));
    $8d = class extends $be {
      get debugName() {
        return this._debugNameData.getDebugName(this) ?? "(anonymous)";
      }
      constructor(_debugNameData, _computeFn, q, s, t = void 0, u) {
        super();
        this._debugNameData = _debugNameData;
        this._computeFn = _computeFn;
        this.q = q;
        this.s = s;
        this.t = t;
        this.u = u;
        this.g = 0;
        this.h = void 0;
        this.j = 0;
        this.k = /* @__PURE__ */ new Set();
        this.l = /* @__PURE__ */ new Set();
        this.m = void 0;
        this.n = false;
        this.p = false;
        this.x = false;
        this.m = this.q?.();
        $Zd()?.handleDerivedCreated(this);
      }
      f() {
        this.g = 0;
        this.h = void 0;
        for (const d of this.k) {
          d.removeObserver(this);
        }
        this.k.clear();
        this.t?.();
      }
      get() {
        if (this.p) {
          throw new $vb("Cyclic deriveds are not supported yet!");
        }
        if (this.b.size === 0) {
          let result;
          try {
            this.x = true;
            result = this._computeFn(this, this.q?.());
          } finally {
            this.x = false;
          }
          this.f();
          return result;
        } else {
          do {
            if (this.g === 1) {
              for (const d of this.k) {
                d.reportChanges();
                if (this.g === 2) {
                  break;
                }
              }
            }
            if (this.g === 1) {
              this.g = 3;
            }
            this.w();
          } while (this.g !== 3);
          return this.h;
        }
      }
      w() {
        if (this.g === 3) {
          return;
        }
        const emptySet = this.l;
        this.l = this.k;
        this.k = emptySet;
        const hadValue = this.g !== 0;
        const oldValue = this.h;
        this.g = 3;
        let didChange = false;
        this.p = false;
        try {
          const changeSummary = this.m;
          this.m = this.q?.();
          try {
            this.x = true;
            this.h = this._computeFn(this, changeSummary);
          } finally {
            this.x = false;
            for (const o of this.l) {
              o.removeObserver(this);
            }
            this.l.clear();
          }
          didChange = hadValue && !this.u(oldValue, this.h);
          $Zd()?.handleDerivedRecomputed(this, {
            oldValue,
            newValue: this.h,
            change: void 0,
            didChange,
            hadValue
          });
        } catch (e) {
          $fb(e);
        }
        this.p = false;
        if (didChange) {
          for (const r of this.b) {
            r.handleChange(this, void 0);
          }
        }
      }
      toString() {
        return `LazyDerived<${this.debugName}>`;
      }
      // IObserver Implementation
      beginUpdate(_observable) {
        if (this.n) {
          throw new $vb("Cyclic deriveds are not supported yet!");
        }
        this.j++;
        this.n = true;
        try {
          const propagateBeginUpdate = this.j === 1;
          if (this.g === 3) {
            this.g = 1;
            if (!propagateBeginUpdate) {
              for (const r of this.b) {
                r.handlePossibleChange(this);
              }
            }
          }
          if (propagateBeginUpdate) {
            for (const r of this.b) {
              r.beginUpdate(this);
            }
          }
        } finally {
          this.n = false;
        }
      }
      endUpdate(_observable) {
        this.j--;
        if (this.j === 0) {
          const observers = [...this.b];
          for (const r of observers) {
            r.endUpdate(this);
          }
        }
        $kd(() => this.j >= 0);
      }
      handlePossibleChange(observable) {
        if (this.g === 3 && this.k.has(observable) && !this.l.has(observable)) {
          this.g = 1;
          for (const r of this.b) {
            r.handlePossibleChange(this);
          }
        }
      }
      handleChange(observable, change) {
        if (this.k.has(observable) && !this.l.has(observable)) {
          let shouldReact = false;
          try {
            shouldReact = this.s ? this.s({
              changedObservable: observable,
              change,
              didChange: (o) => o === observable
            }, this.m) : true;
          } catch (e) {
            $fb(e);
          }
          const wasUpToDate = this.g === 3;
          if (shouldReact && (this.g === 1 || wasUpToDate)) {
            this.g = 2;
            if (wasUpToDate) {
              for (const r of this.b) {
                r.handlePossibleChange(this);
              }
            }
          }
        }
      }
      readObservable(observable) {
        if (!this.x) {
          throw new $vb("The reader object cannot be used outside its compute function!");
        }
        observable.addObserver(this);
        const value = observable.get();
        this.k.add(observable);
        this.l.delete(observable);
        return value;
      }
      addObserver(observer) {
        const shouldCallBeginUpdate = !this.b.has(observer) && this.j > 0;
        super.addObserver(observer);
        if (shouldCallBeginUpdate) {
          observer.beginUpdate(this);
        }
      }
      removeObserver(observer) {
        const shouldCallEndUpdate = this.b.has(observer) && this.j > 0;
        super.removeObserver(observer);
        if (shouldCallEndUpdate) {
          observer.endUpdate(this);
        }
      }
    };
  }
});

// out-build/vs/base/common/observableInternal/promise.js
var init_promise = __esm({
  "out-build/vs/base/common/observableInternal/promise.js"() {
    "use strict";
    init_base();
    init_derived();
  }
});

// out-build/vs/base/common/observableInternal/commonFacade/cancellation.js
var init_cancellation2 = __esm({
  "out-build/vs/base/common/observableInternal/commonFacade/cancellation.js"() {
    "use strict";
    init_errors();
    init_cancellation();
  }
});

// out-build/vs/base/common/observableInternal/utilsCancellation.js
var init_utilsCancellation = __esm({
  "out-build/vs/base/common/observableInternal/utilsCancellation.js"() {
    "use strict";
    init_debugName();
    init_cancellation2();
    init_derived();
    init_deps();
    init_autorun();
  }
});

// out-build/vs/base/common/observableInternal/utils.js
function $Dd(...args) {
  let owner;
  let event;
  let getValue;
  if (args.length === 3) {
    [owner, event, getValue] = args;
  } else {
    [event, getValue] = args;
  }
  return new $Fd(new $dd(owner, void 0, getValue), event, getValue, () => $Fd.globalTransaction, $md);
}
function $Md(observable) {
  const o = new $Od(false, void 0);
  observable.addObserver(o);
  return $1c(() => {
    observable.removeObserver(o);
  });
}
function $Nd(observable, handleValue) {
  const o = new $Od(true, handleValue);
  observable.addObserver(o);
  if (handleValue) {
    handleValue(observable.get());
  } else {
    observable.reportChanges();
  }
  return $1c(() => {
    observable.removeObserver(o);
  });
}
var $Fd, $Od;
var init_utils = __esm({
  "out-build/vs/base/common/observableInternal/utils.js"() {
    "use strict";
    init_autorun();
    init_base();
    init_debugName();
    init_deps();
    init_derived();
    init_logging();
    $Fd = class extends $be {
      constructor(k, l, _getValue, n, p) {
        super();
        this.k = k;
        this.l = l;
        this._getValue = _getValue;
        this.n = n;
        this.p = p;
        this.h = false;
        this.s = (args) => {
          const newValue = this._getValue(args);
          const oldValue = this.g;
          const didChange = !this.h || !this.p(oldValue, newValue);
          let didRunTransaction = false;
          if (didChange) {
            this.g = newValue;
            if (this.h) {
              didRunTransaction = true;
              $fe(this.n(), (tx) => {
                $Zd()?.handleFromEventObservableTriggered(this, { oldValue, newValue, change: void 0, didChange, hadValue: this.h });
                for (const o of this.b) {
                  tx.updateObserver(o, this);
                  o.handleChange(this, void 0);
                }
              }, () => {
                const name = this.q();
                return "Event fired" + (name ? `: ${name}` : "");
              });
            }
            this.h = true;
          }
          if (!didRunTransaction) {
            $Zd()?.handleFromEventObservableTriggered(this, { oldValue, newValue, change: void 0, didChange, hadValue: this.h });
          }
        };
      }
      q() {
        return this.k.getDebugName(this);
      }
      get debugName() {
        const name = this.q();
        return "From Event" + (name ? `: ${name}` : "");
      }
      c() {
        this.j = this.l(this.s);
      }
      f() {
        this.j.dispose();
        this.j = void 0;
        this.h = false;
        this.g = void 0;
      }
      get() {
        if (this.j) {
          if (!this.h) {
            this.s(void 0);
          }
          return this.g;
        } else {
          const value = this._getValue(void 0);
          return value;
        }
      }
    };
    (function($Dd2) {
      $Dd2.Observer = $Fd;
      function batchEventsGlobally(tx, fn) {
        let didSet = false;
        if ($Fd.globalTransaction === void 0) {
          $Fd.globalTransaction = tx;
          didSet = true;
        }
        try {
          fn();
        } finally {
          if (didSet) {
            $Fd.globalTransaction = void 0;
          }
        }
      }
      $Dd2.batchEventsGlobally = batchEventsGlobally;
    })($Dd || ($Dd = {}));
    $$d($Md);
    $0d($Nd);
    $Od = class {
      constructor(b, c) {
        this.b = b;
        this.c = c;
        this.a = 0;
      }
      beginUpdate(observable) {
        this.a++;
      }
      endUpdate(observable) {
        this.a--;
        if (this.a === 0 && this.b) {
          if (this.c) {
            this.c(observable.get());
          } else {
            observable.reportChanges();
          }
        }
      }
      handlePossibleChange(observable) {
      }
      handleChange(observable, change) {
      }
    };
  }
});

// out-build/vs/base/common/observableInternal/index.js
var enableLogging;
var init_observableInternal = __esm({
  "out-build/vs/base/common/observableInternal/index.js"() {
    "use strict";
    init_api();
    init_autorun();
    init_base();
    init_derived();
    init_promise();
    init_utilsCancellation();
    init_utils();
    init_logging();
    enableLogging = false;
    if (enableLogging) {
      $Yd(new $1d());
    }
  }
});

// out-build/vs/base/common/observable.js
var init_observable = __esm({
  "out-build/vs/base/common/observable.js"() {
    "use strict";
    init_observableInternal();
  }
});

// out-build/vs/workbench/contrib/chat/common/chatContextKeys.js
var ChatContextKeys;
var init_chatContextKeys = __esm({
  "out-build/vs/workbench/contrib/chat/common/chatContextKeys.js"() {
    "use strict";
    init_nls2();
    init_contextkey();
    (function(ChatContextKeys2) {
      ChatContextKeys2.responseVote = new $nn("chatSessionResponseVote", "", { type: "string", description: localize(5076, null) });
      ChatContextKeys2.responseDetectedAgentCommand = new $nn("chatSessionResponseDetectedAgentOrCommand", false, { type: "boolean", description: localize(5077, null) });
      ChatContextKeys2.responseSupportsIssueReporting = new $nn("chatResponseSupportsIssueReporting", false, { type: "boolean", description: localize(5078, null) });
      ChatContextKeys2.responseIsFiltered = new $nn("chatSessionResponseFiltered", false, { type: "boolean", description: localize(5079, null) });
      ChatContextKeys2.responseHasError = new $nn("chatSessionResponseError", false, { type: "boolean", description: localize(5080, null) });
      ChatContextKeys2.requestInProgress = new $nn("chatSessionRequestInProgress", false, { type: "boolean", description: localize(5081, null) });
      ChatContextKeys2.isResponse = new $nn("chatResponse", false, { type: "boolean", description: localize(5082, null) });
      ChatContextKeys2.isRequest = new $nn("chatRequest", false, { type: "boolean", description: localize(5083, null) });
      ChatContextKeys2.itemId = new $nn("chatItemId", "", { type: "string", description: localize(5084, null) });
      ChatContextKeys2.lastItemId = new $nn("chatLastItemId", [], { type: "string", description: localize(5085, null) });
      ChatContextKeys2.editApplied = new $nn("chatEditApplied", false, { type: "boolean", description: localize(5086, null) });
      ChatContextKeys2.inputHasText = new $nn("chatInputHasText", false, { type: "boolean", description: localize(5087, null) });
      ChatContextKeys2.inputHasFocus = new $nn("chatInputHasFocus", false, { type: "boolean", description: localize(5088, null) });
      ChatContextKeys2.inChatInput = new $nn("inChatInput", false, { type: "boolean", description: localize(5089, null) });
      ChatContextKeys2.inChatSession = new $nn("inChat", false, { type: "boolean", description: localize(5090, null) });
      ChatContextKeys2.enabled = new $nn("chatIsEnabled", false, { type: "boolean", description: localize(5091, null) });
      ChatContextKeys2.panelParticipantRegistered = new $nn("chatPanelParticipantRegistered", false, { type: "boolean", description: localize(5092, null) });
      ChatContextKeys2.editingParticipantRegistered = new $nn("chatEditingParticipantRegistered", false, { type: "boolean", description: localize(5093, null) });
      ChatContextKeys2.chatEditingCanUndo = new $nn("chatEditingCanUndo", false, { type: "boolean", description: localize(5094, null) });
      ChatContextKeys2.chatEditingCanRedo = new $nn("chatEditingCanRedo", false, { type: "boolean", description: localize(5095, null) });
      ChatContextKeys2.extensionInvalid = new $nn("chatExtensionInvalid", false, { type: "boolean", description: localize(5096, null) });
      ChatContextKeys2.inputCursorAtTop = new $nn("chatCursorAtTop", false);
      ChatContextKeys2.inputHasAgent = new $nn("chatInputHasAgent", false);
      ChatContextKeys2.location = new $nn("chatLocation", void 0);
      ChatContextKeys2.inQuickChat = new $nn("quickChatHasFocus", false, { type: "boolean", description: localize(5097, null) });
      ChatContextKeys2.hasFileAttachments = new $nn("chatHasFileAttachments", false, { type: "boolean", description: localize(5098, null) });
      ChatContextKeys2.languageModelsAreUserSelectable = new $nn("chatModelsAreUserSelectable", false, { type: "boolean", description: localize(5099, null) });
      ChatContextKeys2.Setup = {
        canSignUp: new $nn("chatSetupCanSignUp", false, true),
        // True when user can sign up to be a chat limited user.
        signedOut: new $nn("chatSetupSignedOut", false, true),
        // True when user is signed out.
        limited: new $nn("chatSetupLimited", false, true),
        // True when user is a chat limited user.
        triggered: new $nn("chatSetupTriggered", false, true),
        // True when chat setup is triggered.
        installed: new $nn("chatSetupInstalled", false, true)
        // True when the chat extension is installed.
      };
      ChatContextKeys2.chatQuotaExceeded = new $nn("chatQuotaExceeded", false, true);
      ChatContextKeys2.completionsQuotaExceeded = new $nn("completionsQuotaExceeded", false, true);
    })(ChatContextKeys || (ChatContextKeys = {}));
  }
});

// out-build/vs/workbench/contrib/chat/common/chatAgents.js
function $5O(chatAgentData) {
  return `${chatAgentData.extensionId.value}.${chatAgentData.id}`;
}
var $4O_1, ChatAgentLocation, $ZO, $1O, $2O, $3O, $4O;
var init_chatAgents = __esm({
  "out-build/vs/workbench/contrib/chat/common/chatAgents.js"() {
    "use strict";
    init_arraysFind();
    init_async();
    init_cancellation();
    init_event();
    init_htmlContent();
    init_iterator();
    init_lifecycle();
    init_marshalling();
    init_observable();
    init_strings();
    init_themables();
    init_contextkey();
    init_extensions();
    init_instantiation();
    init_log();
    init_productService();
    init_request();
    init_storage2();
    init_chatContextKeys();
    (function(ChatAgentLocation2) {
      ChatAgentLocation2["Panel"] = "panel";
      ChatAgentLocation2["Terminal"] = "terminal";
      ChatAgentLocation2["Notebook"] = "notebook";
      ChatAgentLocation2["Editor"] = "editor";
      ChatAgentLocation2["EditingSession"] = "editing-session";
    })(ChatAgentLocation || (ChatAgentLocation = {}));
    (function(ChatAgentLocation2) {
      function fromRaw(value) {
        switch (value) {
          case "panel":
            return ChatAgentLocation2.Panel;
          case "terminal":
            return ChatAgentLocation2.Terminal;
          case "notebook":
            return ChatAgentLocation2.Notebook;
          case "editor":
            return ChatAgentLocation2.Editor;
          case "editing-session":
            return ChatAgentLocation2.EditingSession;
        }
        return ChatAgentLocation2.Panel;
      }
      ChatAgentLocation2.fromRaw = fromRaw;
    })(ChatAgentLocation || (ChatAgentLocation = {}));
    $ZO = $Qk("chatAgentService");
    $1O = class $1O2 extends $3c {
      static {
        this.AGENT_LEADER = "@";
      }
      constructor(r) {
        super();
        this.r = r;
        this.b = /* @__PURE__ */ new Map();
        this.f = new $ze();
        this.onDidChangeAgents = this.f.event;
        this.g = /* @__PURE__ */ new Set();
        this.n = /* @__PURE__ */ new Map();
        this.u = /* @__PURE__ */ new Map();
        this.h = ChatContextKeys.enabled.bindTo(this.r);
        this.j = ChatContextKeys.panelParticipantRegistered.bindTo(this.r);
        this.m = ChatContextKeys.editingParticipantRegistered.bindTo(this.r);
        this.B(r.onDidChangeContext((e) => {
          if (e.affectsSome(this.g)) {
            this.t();
          }
        }));
      }
      registerAgent(id2, data) {
        const existingAgent = this.getAgent(id2);
        if (existingAgent) {
          throw new Error(`Agent already registered: ${JSON.stringify(id2)}`);
        }
        const that = this;
        const commands = data.slashCommands;
        data = {
          ...data,
          get slashCommands() {
            return commands.filter((c) => !c.when || that.r.contextMatchesRules($7m.deserialize(c.when)));
          }
        };
        const entry = { data };
        this.b.set(id2, entry);
        this.s();
        this.t();
        this.f.fire(void 0);
        return $1c(() => {
          this.b.delete(id2);
          this.s();
          this.t();
          this.f.fire(void 0);
        });
      }
      s() {
        this.g.clear();
        for (const agent of this.b.values()) {
          if (agent.data.when) {
            const expr = $7m.deserialize(agent.data.when);
            for (const key of expr?.keys() || []) {
              this.g.add(key);
            }
          }
        }
      }
      t() {
        let editingAgentRegistered = false;
        let defaultAgentRegistered = false;
        for (const agent of this.getAgents()) {
          if (agent.isDefault && agent.locations.includes(ChatAgentLocation.EditingSession)) {
            editingAgentRegistered = true;
          } else if (agent.isDefault) {
            defaultAgentRegistered = true;
          }
        }
        this.m.set(editingAgentRegistered);
        this.j.set(defaultAgentRegistered);
      }
      registerAgentImplementation(id2, agentImpl) {
        const entry = this.b.get(id2);
        if (!entry) {
          throw new Error(`Unknown agent: ${JSON.stringify(id2)}`);
        }
        if (entry.impl) {
          throw new Error(`Agent already has implementation: ${JSON.stringify(id2)}`);
        }
        if (entry.data.isDefault) {
          this.h.set(true);
        }
        entry.impl = agentImpl;
        this.f.fire(new $2O(entry.data, agentImpl));
        return $1c(() => {
          entry.impl = void 0;
          this.f.fire(void 0);
          if (entry.data.isDefault) {
            this.h.set(false);
          }
        });
      }
      registerDynamicAgent(data, agentImpl) {
        data.isDynamic = true;
        const agent = { data, impl: agentImpl };
        this.b.set(data.id, agent);
        this.f.fire(new $2O(data, agentImpl));
        return $1c(() => {
          this.b.delete(data.id);
          this.f.fire(void 0);
        });
      }
      registerAgentCompletionProvider(id2, provider) {
        this.u.set(id2, provider);
        return {
          dispose: () => {
            this.u.delete(id2);
          }
        };
      }
      async getAgentCompletionItems(id2, query, token) {
        return await this.u.get(id2)?.(query, token) ?? [];
      }
      updateAgent(id2, updateMetadata) {
        const agent = this.b.get(id2);
        if (!agent?.impl) {
          throw new Error(`No activated agent with id ${JSON.stringify(id2)} registered`);
        }
        agent.data.metadata = { ...agent.data.metadata, ...updateMetadata };
        this.f.fire(new $2O(agent.data, agent.impl));
      }
      getDefaultAgent(location2) {
        return $1(this.getActivatedAgents(), (a) => !!a.isDefault && a.locations.includes(location2));
      }
      getContributedDefaultAgent(location2) {
        return this.getAgents().find((a) => !!a.isDefault && a.locations.includes(location2));
      }
      getSecondaryAgent() {
        return Iterable.find(this.b.values(), (a) => !!a.data.metadata.isSecondary)?.data;
      }
      getAgent(id2, includeDisabled = false) {
        if (!this.w(id2) && !includeDisabled) {
          return;
        }
        return this.b.get(id2)?.data;
      }
      w(id2) {
        const entry = this.b.get(id2);
        return !entry?.data.when || this.r.contextMatchesRules($7m.deserialize(entry.data.when));
      }
      getAgentByFullyQualifiedId(id2) {
        const agent = Iterable.find(this.b.values(), (a) => $5O(a.data) === id2)?.data;
        if (agent && !this.w(agent.id)) {
          return;
        }
        return agent;
      }
      /**
       * Returns all agent datas that exist- static registered and dynamic ones.
       */
      getAgents() {
        return Array.from(this.b.values()).map((entry) => entry.data).filter((a) => this.w(a.id));
      }
      getActivatedAgents() {
        return Array.from(this.b.values()).filter((a) => !!a.impl).filter((a) => this.w(a.data.id)).map((a) => new $2O(a.data, a.impl));
      }
      getAgentsByName(name) {
        return this.getAgents().filter((a) => a.name === name);
      }
      agentHasDupeName(id2) {
        const agent = this.getAgent(id2);
        if (!agent) {
          return false;
        }
        return this.getAgentsByName(agent.name).filter((a) => a.extensionId.value !== agent.extensionId.value).length > 0;
      }
      async invokeAgent(id2, request2, progress, history, token) {
        const data = this.b.get(id2);
        if (!data?.impl) {
          throw new Error(`No activated agent with id "${id2}"`);
        }
        return await data.impl.invoke(request2, progress, history, token);
      }
      async getFollowups(id2, request2, result, history, token) {
        const data = this.b.get(id2);
        if (!data?.impl) {
          throw new Error(`No activated agent with id "${id2}"`);
        }
        if (!data.impl?.provideFollowups) {
          return [];
        }
        return data.impl.provideFollowups(request2, result, history, token);
      }
      async getChatTitle(id2, history, token) {
        const data = this.b.get(id2);
        if (!data?.impl) {
          throw new Error(`No activated agent with id "${id2}"`);
        }
        if (!data.impl?.provideChatTitle) {
          return void 0;
        }
        return data.impl.provideChatTitle(history, token);
      }
      registerChatParticipantDetectionProvider(handle, provider) {
        this.n.set(handle, provider);
        return $1c(() => {
          this.n.delete(handle);
        });
      }
      hasChatParticipantDetectionProviders() {
        return this.n.size > 0;
      }
      async detectAgentOrCommand(request2, history, options2, token) {
        const provider = Iterable.first(this.n.values());
        if (!provider) {
          return;
        }
        const participants = this.getAgents().reduce((acc, a) => {
          if (a.locations.includes(options2.location)) {
            acc.push({ participant: a.id, disambiguation: a.disambiguation ?? [] });
            for (const command2 of a.slashCommands) {
              acc.push({ participant: a.id, command: command2.name, disambiguation: command2.disambiguation ?? [] });
            }
          }
          return acc;
        }, []);
        const result = await provider.provideParticipantDetection(request2, history, { ...options2, participants }, token);
        if (!result) {
          return;
        }
        const agent = this.getAgent(result.participant);
        if (!agent) {
          return;
        }
        if (!result.command) {
          return { agent };
        }
        const command = agent?.slashCommands.find((c) => c.name === result.command);
        if (!command) {
          return;
        }
        return { agent, command };
      }
    };
    $1O = __decorate([
      __param(0, $on)
    ], $1O);
    $2O = class {
      constructor(b, d) {
        this.b = b;
        this.d = d;
      }
      get id() {
        return this.b.id;
      }
      get name() {
        return this.b.name ?? "";
      }
      get fullName() {
        return this.b.fullName ?? "";
      }
      get description() {
        return this.b.description ?? "";
      }
      get extensionId() {
        return this.b.extensionId;
      }
      get extensionPublisherId() {
        return this.b.extensionPublisherId;
      }
      get extensionPublisherDisplayName() {
        return this.b.publisherDisplayName;
      }
      get extensionDisplayName() {
        return this.b.extensionDisplayName;
      }
      get isDefault() {
        return this.b.isDefault;
      }
      get metadata() {
        return this.b.metadata;
      }
      get slashCommands() {
        return this.b.slashCommands;
      }
      get locations() {
        return this.b.locations;
      }
      get disambiguation() {
        return this.b.disambiguation;
      }
      async invoke(request2, progress, history, token) {
        return this.d.invoke(request2, progress, history, token);
      }
      async provideFollowups(request2, result, history, token) {
        if (this.d.provideFollowups) {
          return this.d.provideFollowups(request2, result, history, token);
        }
        return [];
      }
      provideWelcomeMessage(token) {
        if (this.d.provideWelcomeMessage) {
          return this.d.provideWelcomeMessage(token);
        }
        return void 0;
      }
      provideSampleQuestions(location2, token) {
        if (this.d.provideSampleQuestions) {
          return this.d.provideSampleQuestions(location2, token);
        }
        return void 0;
      }
      toJSON() {
        return this.b;
      }
    };
    $3O = $Qk("chatAgentNameService");
    $4O = class $4O2 {
      static {
        $4O_1 = this;
      }
      static {
        this.b = "chat.participantNameRegistry";
      }
      constructor(productService, h, i, j) {
        this.h = h;
        this.i = i;
        this.j = j;
        this.f = $he(this, /* @__PURE__ */ Object.create(null));
        this.g = false;
        if (!productService.chatParticipantRegistry) {
          return;
        }
        this.d = productService.chatParticipantRegistry;
        const raw = j.get(
          $4O_1.b,
          -1
          /* StorageScope.APPLICATION */
        );
        try {
          this.f.set(JSON.parse(raw ?? "{}"), void 0);
        } catch (err) {
          j.remove(
            $4O_1.b,
            -1
            /* StorageScope.APPLICATION */
          );
        }
        this.k();
      }
      k() {
        if (this.g) {
          return;
        }
        this.l().catch((err) => this.i.warn("Failed to fetch chat participant registry", err)).then(() => $Wh(5 * 60 * 1e3)).then(() => this.k());
      }
      async l() {
        const context = await this.h.request({ type: "GET", url: this.d }, CancellationToken.None);
        if (context.res.statusCode !== 200) {
          throw new Error("Could not get extensions report.");
        }
        const result = await $cv(context);
        if (!result || result.version !== 1) {
          throw new Error("Unexpected chat participant registry response.");
        }
        const registry = result.restrictedChatParticipants;
        this.f.set(registry, void 0);
        this.j.store(
          $4O_1.b,
          JSON.stringify(registry),
          -1,
          1
          /* StorageTarget.MACHINE */
        );
      }
      /**
       * Returns true if the agent is allowed to use this name
       */
      getAgentNameRestriction(chatAgentData) {
        const nameAllowed = this.m(chatAgentData.name, chatAgentData).get();
        const fullNameAllowed = !chatAgentData.fullName || this.m(chatAgentData.fullName.replace(/\s/g, ""), chatAgentData).get();
        return nameAllowed && fullNameAllowed;
      }
      m(name, chatAgentData) {
        const allowList = this.f.map((registry) => registry[name.toLowerCase()]);
        return allowList.map((allowList2) => {
          if (!allowList2) {
            return true;
          }
          return allowList2.some((id2) => $1f(id2, id2.includes(".") ? chatAgentData.extensionId.value : chatAgentData.extensionPublisherId));
        });
      }
      dispose() {
        this.g = true;
      }
    };
    $4O = $4O_1 = __decorate([
      __param(0, $Vu),
      __param(1, $9u),
      __param(2, $wn),
      __param(3, $jv)
    ], $4O);
  }
});

// out-build/vs/workbench/contrib/testing/common/testId.js
var TestIdPathParts, TestPosition, $mQ;
var init_testId = __esm({
  "out-build/vs/workbench/contrib/testing/common/testId.js"() {
    "use strict";
    (function(TestIdPathParts2) {
      TestIdPathParts2["Delimiter"] = "\0";
    })(TestIdPathParts || (TestIdPathParts = {}));
    (function(TestPosition2) {
      TestPosition2[TestPosition2["IsSame"] = 0] = "IsSame";
      TestPosition2[TestPosition2["Disconnected"] = 1] = "Disconnected";
      TestPosition2[TestPosition2["IsChild"] = 2] = "IsChild";
      TestPosition2[TestPosition2["IsParent"] = 3] = "IsParent";
    })(TestPosition || (TestPosition = {}));
    $mQ = class _$mQ {
      /**
       * Creates a test ID from an ext host test item.
       */
      static fromExtHostTestItem(item, rootId, parent = item.parent) {
        if (item._isRoot) {
          return new _$mQ([rootId]);
        }
        const path7 = [item.id];
        for (let i = parent; i && i.id !== rootId; i = i.parent) {
          path7.push(i.id);
        }
        path7.push(rootId);
        return new _$mQ(path7.reverse());
      }
      /**
       * Cheaply ets whether the ID refers to the root .
       */
      static isRoot(idString) {
        return !idString.includes(
          "\0"
          /* TestIdPathParts.Delimiter */
        );
      }
      /**
       * Cheaply gets whether the ID refers to the root .
       */
      static root(idString) {
        const idx = idString.indexOf(
          "\0"
          /* TestIdPathParts.Delimiter */
        );
        return idx === -1 ? idString : idString.slice(0, idx);
      }
      /**
       * Creates a test ID from a serialized TestId instance.
       */
      static fromString(idString) {
        return new _$mQ(idString.split(
          "\0"
          /* TestIdPathParts.Delimiter */
        ));
      }
      /**
       * Gets the ID resulting from adding b to the base ID.
       */
      static join(base, b) {
        return new _$mQ([...base.path, b]);
      }
      /**
       * Gets the string ID resulting from adding b to the base ID.
       */
      static joinToString(base, b) {
        return base.toString() + "\0" + b;
      }
      /**
       * Cheaply gets the parent ID of a test identified with the string.
       */
      static parentId(idString) {
        const idx = idString.lastIndexOf(
          "\0"
          /* TestIdPathParts.Delimiter */
        );
        return idx === -1 ? void 0 : idString.slice(0, idx);
      }
      /**
       * Cheaply gets the local ID of a test identified with the string.
       */
      static localId(idString) {
        const idx = idString.lastIndexOf(
          "\0"
          /* TestIdPathParts.Delimiter */
        );
        return idx === -1 ? idString : idString.slice(idx + "\0".length);
      }
      /**
       * Gets whether maybeChild is a child of maybeParent.
       * todo@connor4312: review usages of this to see if using the WellDefinedPrefixTree is better
       */
      static isChild(maybeParent, maybeChild) {
        return maybeChild[maybeParent.length] === "\0" && maybeChild.startsWith(maybeParent);
      }
      /**
       * Compares the position of the two ID strings.
       * todo@connor4312: review usages of this to see if using the WellDefinedPrefixTree is better
       */
      static compare(a, b) {
        if (a === b) {
          return 0;
        }
        if (_$mQ.isChild(a, b)) {
          return 2;
        }
        if (_$mQ.isChild(b, a)) {
          return 3;
        }
        return 1;
      }
      static getLengthOfCommonPrefix(length, getId) {
        if (length === 0) {
          return 0;
        }
        let commonPrefix = 0;
        while (commonPrefix < length - 1) {
          for (let i = 1; i < length; i++) {
            const a = getId(i - 1);
            const b = getId(i);
            if (a.path[commonPrefix] !== b.path[commonPrefix]) {
              return commonPrefix;
            }
          }
          commonPrefix++;
        }
        return commonPrefix;
      }
      constructor(path7, d = path7.length) {
        this.path = path7;
        this.d = d;
        if (path7.length === 0 || d < 1) {
          throw new Error("cannot create test with empty path");
        }
      }
      /**
       * Gets the ID of the parent test.
       */
      get rootId() {
        return new _$mQ(this.path, 1);
      }
      /**
       * Gets the ID of the parent test.
       */
      get parentId() {
        return this.d > 1 ? new _$mQ(this.path, this.d - 1) : void 0;
      }
      /**
       * Gets the local ID of the current full test ID.
       */
      get localId() {
        return this.path[this.d - 1];
      }
      /**
       * Gets whether this ID refers to the root.
       */
      get controllerId() {
        return this.path[0];
      }
      /**
       * Gets whether this ID refers to the root.
       */
      get isRoot() {
        return this.d === 1;
      }
      /**
       * Returns an iterable that yields IDs of all parent items down to and
       * including the current item.
       */
      *idsFromRoot() {
        for (let i = 1; i <= this.d; i++) {
          yield new _$mQ(this.path, i);
        }
      }
      /**
       * Returns an iterable that yields IDs of the current item up to the root
       * item.
       */
      *idsToRoot() {
        for (let i = this.d; i > 0; i--) {
          yield new _$mQ(this.path, i);
        }
      }
      /**
       * Compares the other test ID with this one.
       */
      compare(other) {
        if (typeof other === "string") {
          return _$mQ.compare(this.toString(), other);
        }
        for (let i = 0; i < other.d && i < this.d; i++) {
          if (other.path[i] !== this.path[i]) {
            return 1;
          }
        }
        if (other.d > this.d) {
          return 2;
        }
        if (other.d < this.d) {
          return 3;
        }
        return 0;
      }
      /**
       * Serializes the ID.
       */
      toJSON() {
        return this.toString();
      }
      /**
       * Serializes the ID to a string.
       */
      toString() {
        if (!this.c) {
          this.c = this.path[0];
          for (let i = 1; i < this.d; i++) {
            this.c += "\0";
            this.c += this.path[i];
          }
        }
        return this.c;
      }
    };
  }
});

// out-build/vs/workbench/contrib/testing/common/testTypes.js
function serializeThingWithLocation(serialized) {
  return {
    ...serialized,
    location: serialized.location?.toJSON()
  };
}
function deserializeThingWithLocation(serialized) {
  serialized.location = serialized.location ? $8C.isIPosition(serialized.location) ? $8C.lift(serialized.location) : $9C.lift(serialized.location) : void 0;
  return serialized;
}
var TestResultState2, ExtTestRunProfileKind, TestControllerCapability, TestRunProfileBitset, $oQ, IRichLocation, TestMessageType, ITestMessageStackFrame, ITestErrorMessage, ITestOutputMessage, ITestMessage, ITestTaskState, testTagDelimiter, $sQ, $tQ, ITestItem, TestItemExpandState, InternalTestItem, ITestItemUpdate, TestResultItem, ICoverageCount, IFileCoverage, DetailType, CoverageDetails, IBranchCoverage, IDeclarationCoverage, IStatementCoverage, TestDiffOpType, TestsDiffOp;
var init_testTypes = __esm({
  "out-build/vs/workbench/contrib/testing/common/testTypes.js"() {
    "use strict";
    init_uri();
    init_position();
    init_range();
    init_nls2();
    init_testId();
    (function(TestResultState3) {
      TestResultState3[TestResultState3["Unset"] = 0] = "Unset";
      TestResultState3[TestResultState3["Queued"] = 1] = "Queued";
      TestResultState3[TestResultState3["Running"] = 2] = "Running";
      TestResultState3[TestResultState3["Passed"] = 3] = "Passed";
      TestResultState3[TestResultState3["Failed"] = 4] = "Failed";
      TestResultState3[TestResultState3["Skipped"] = 5] = "Skipped";
      TestResultState3[TestResultState3["Errored"] = 6] = "Errored";
    })(TestResultState2 || (TestResultState2 = {}));
    (function(ExtTestRunProfileKind2) {
      ExtTestRunProfileKind2[ExtTestRunProfileKind2["Run"] = 1] = "Run";
      ExtTestRunProfileKind2[ExtTestRunProfileKind2["Debug"] = 2] = "Debug";
      ExtTestRunProfileKind2[ExtTestRunProfileKind2["Coverage"] = 3] = "Coverage";
    })(ExtTestRunProfileKind || (ExtTestRunProfileKind = {}));
    (function(TestControllerCapability2) {
      TestControllerCapability2[TestControllerCapability2["Refresh"] = 2] = "Refresh";
      TestControllerCapability2[TestControllerCapability2["CodeRelatedToTest"] = 4] = "CodeRelatedToTest";
      TestControllerCapability2[TestControllerCapability2["TestRelatedToCode"] = 8] = "TestRelatedToCode";
    })(TestControllerCapability || (TestControllerCapability = {}));
    (function(TestRunProfileBitset2) {
      TestRunProfileBitset2[TestRunProfileBitset2["Run"] = 2] = "Run";
      TestRunProfileBitset2[TestRunProfileBitset2["Debug"] = 4] = "Debug";
      TestRunProfileBitset2[TestRunProfileBitset2["Coverage"] = 8] = "Coverage";
      TestRunProfileBitset2[TestRunProfileBitset2["HasNonDefaultProfile"] = 16] = "HasNonDefaultProfile";
      TestRunProfileBitset2[TestRunProfileBitset2["HasConfigurable"] = 32] = "HasConfigurable";
      TestRunProfileBitset2[TestRunProfileBitset2["SupportsContinuousRun"] = 64] = "SupportsContinuousRun";
    })(TestRunProfileBitset || (TestRunProfileBitset = {}));
    $oQ = {
      [
        2
        /* TestRunProfileBitset.Run */
      ]: localize(11359, null),
      [
        4
        /* TestRunProfileBitset.Debug */
      ]: localize(11360, null),
      [
        8
        /* TestRunProfileBitset.Coverage */
      ]: localize(11361, null)
    };
    (function(IRichLocation2) {
      IRichLocation2.serialize = (location2) => ({
        range: location2.range.toJSON(),
        uri: location2.uri.toJSON()
      });
      IRichLocation2.deserialize = (uriIdentity, location2) => ({
        range: $9C.lift(location2.range),
        uri: uriIdentity.asCanonicalUri(URI.revive(location2.uri))
      });
    })(IRichLocation || (IRichLocation = {}));
    (function(TestMessageType2) {
      TestMessageType2[TestMessageType2["Error"] = 0] = "Error";
      TestMessageType2[TestMessageType2["Output"] = 1] = "Output";
    })(TestMessageType || (TestMessageType = {}));
    (function(ITestMessageStackFrame2) {
      ITestMessageStackFrame2.serialize = (stack) => ({
        label: stack.label,
        uri: stack.uri?.toJSON(),
        position: stack.position?.toJSON()
      });
      ITestMessageStackFrame2.deserialize = (uriIdentity, stack) => ({
        label: stack.label,
        uri: stack.uri ? uriIdentity.asCanonicalUri(URI.revive(stack.uri)) : void 0,
        position: stack.position ? $8C.lift(stack.position) : void 0
      });
    })(ITestMessageStackFrame || (ITestMessageStackFrame = {}));
    (function(ITestErrorMessage2) {
      ITestErrorMessage2.serialize = (message) => ({
        message: message.message,
        type: 0,
        expected: message.expected,
        actual: message.actual,
        contextValue: message.contextValue,
        location: message.location && IRichLocation.serialize(message.location),
        stackTrace: message.stackTrace?.map(ITestMessageStackFrame.serialize)
      });
      ITestErrorMessage2.deserialize = (uriIdentity, message) => ({
        message: message.message,
        type: 0,
        expected: message.expected,
        actual: message.actual,
        contextValue: message.contextValue,
        location: message.location && IRichLocation.deserialize(uriIdentity, message.location),
        stackTrace: message.stackTrace && message.stackTrace.map((s) => ITestMessageStackFrame.deserialize(uriIdentity, s))
      });
    })(ITestErrorMessage || (ITestErrorMessage = {}));
    (function(ITestOutputMessage2) {
      ITestOutputMessage2.serialize = (message) => ({
        message: message.message,
        type: 1,
        offset: message.offset,
        length: message.length,
        location: message.location && IRichLocation.serialize(message.location)
      });
      ITestOutputMessage2.deserialize = (uriIdentity, message) => ({
        message: message.message,
        type: 1,
        offset: message.offset,
        length: message.length,
        location: message.location && IRichLocation.deserialize(uriIdentity, message.location)
      });
    })(ITestOutputMessage || (ITestOutputMessage = {}));
    (function(ITestMessage2) {
      ITestMessage2.serialize = (message) => message.type === 0 ? ITestErrorMessage.serialize(message) : ITestOutputMessage.serialize(message);
      ITestMessage2.deserialize = (uriIdentity, message) => message.type === 0 ? ITestErrorMessage.deserialize(uriIdentity, message) : ITestOutputMessage.deserialize(uriIdentity, message);
      ITestMessage2.isDiffable = (message) => message.type === 0 && message.actual !== void 0 && message.expected !== void 0;
    })(ITestMessage || (ITestMessage = {}));
    (function(ITestTaskState2) {
      ITestTaskState2.serializeWithoutMessages = (state) => ({
        state: state.state,
        duration: state.duration,
        messages: []
      });
      ITestTaskState2.serialize = (state) => ({
        state: state.state,
        duration: state.duration,
        messages: state.messages.map(ITestMessage.serialize)
      });
      ITestTaskState2.deserialize = (uriIdentity, state) => ({
        state: state.state,
        duration: state.duration,
        messages: state.messages.map((m) => ITestMessage.deserialize(uriIdentity, m))
      });
    })(ITestTaskState || (ITestTaskState = {}));
    testTagDelimiter = "\0";
    $sQ = (ctrlId, tagId) => ctrlId + testTagDelimiter + tagId;
    $tQ = (namespaced) => {
      const index = namespaced.indexOf(testTagDelimiter);
      return { ctrlId: namespaced.slice(0, index), tagId: namespaced.slice(index + 1) };
    };
    (function(ITestItem2) {
      ITestItem2.serialize = (item) => ({
        extId: item.extId,
        label: item.label,
        tags: item.tags,
        busy: item.busy,
        children: void 0,
        uri: item.uri?.toJSON(),
        range: item.range?.toJSON() || null,
        description: item.description,
        error: item.error,
        sortText: item.sortText
      });
      ITestItem2.deserialize = (uriIdentity, serialized) => ({
        extId: serialized.extId,
        label: serialized.label,
        tags: serialized.tags,
        busy: serialized.busy,
        children: void 0,
        uri: serialized.uri ? uriIdentity.asCanonicalUri(URI.revive(serialized.uri)) : void 0,
        range: serialized.range ? $9C.lift(serialized.range) : null,
        description: serialized.description,
        error: serialized.error,
        sortText: serialized.sortText
      });
    })(ITestItem || (ITestItem = {}));
    (function(TestItemExpandState2) {
      TestItemExpandState2[TestItemExpandState2["NotExpandable"] = 0] = "NotExpandable";
      TestItemExpandState2[TestItemExpandState2["Expandable"] = 1] = "Expandable";
      TestItemExpandState2[TestItemExpandState2["BusyExpanding"] = 2] = "BusyExpanding";
      TestItemExpandState2[TestItemExpandState2["Expanded"] = 3] = "Expanded";
    })(TestItemExpandState || (TestItemExpandState = {}));
    (function(InternalTestItem2) {
      InternalTestItem2.serialize = (item) => ({
        expand: item.expand,
        item: ITestItem.serialize(item.item)
      });
      InternalTestItem2.deserialize = (uriIdentity, serialized) => ({
        // the `controllerId` is derived from the test.item.extId. It's redundant
        // in the non-serialized InternalTestItem too, but there just because it's
        // checked against in many hot paths.
        controllerId: $mQ.root(serialized.item.extId),
        expand: serialized.expand,
        item: ITestItem.deserialize(uriIdentity, serialized.item)
      });
    })(InternalTestItem || (InternalTestItem = {}));
    (function(ITestItemUpdate2) {
      ITestItemUpdate2.serialize = (u) => {
        let item;
        if (u.item) {
          item = {};
          if (u.item.label !== void 0) {
            item.label = u.item.label;
          }
          if (u.item.tags !== void 0) {
            item.tags = u.item.tags;
          }
          if (u.item.busy !== void 0) {
            item.busy = u.item.busy;
          }
          if (u.item.uri !== void 0) {
            item.uri = u.item.uri?.toJSON();
          }
          if (u.item.range !== void 0) {
            item.range = u.item.range?.toJSON();
          }
          if (u.item.description !== void 0) {
            item.description = u.item.description;
          }
          if (u.item.error !== void 0) {
            item.error = u.item.error;
          }
          if (u.item.sortText !== void 0) {
            item.sortText = u.item.sortText;
          }
        }
        return { extId: u.extId, expand: u.expand, item };
      };
      ITestItemUpdate2.deserialize = (u) => {
        let item;
        if (u.item) {
          item = {};
          if (u.item.label !== void 0) {
            item.label = u.item.label;
          }
          if (u.item.tags !== void 0) {
            item.tags = u.item.tags;
          }
          if (u.item.busy !== void 0) {
            item.busy = u.item.busy;
          }
          if (u.item.range !== void 0) {
            item.range = u.item.range ? $9C.lift(u.item.range) : null;
          }
          if (u.item.description !== void 0) {
            item.description = u.item.description;
          }
          if (u.item.error !== void 0) {
            item.error = u.item.error;
          }
          if (u.item.sortText !== void 0) {
            item.sortText = u.item.sortText;
          }
        }
        return { extId: u.extId, expand: u.expand, item };
      };
    })(ITestItemUpdate || (ITestItemUpdate = {}));
    (function(TestResultItem2) {
      TestResultItem2.serializeWithoutMessages = (original) => ({
        ...InternalTestItem.serialize(original),
        ownComputedState: original.ownComputedState,
        computedState: original.computedState,
        tasks: original.tasks.map(ITestTaskState.serializeWithoutMessages)
      });
      TestResultItem2.serialize = (original) => ({
        ...InternalTestItem.serialize(original),
        ownComputedState: original.ownComputedState,
        computedState: original.computedState,
        tasks: original.tasks.map(ITestTaskState.serialize)
      });
      TestResultItem2.deserialize = (uriIdentity, serialized) => ({
        ...InternalTestItem.deserialize(uriIdentity, serialized),
        ownComputedState: serialized.ownComputedState,
        computedState: serialized.computedState,
        tasks: serialized.tasks.map((m) => ITestTaskState.deserialize(uriIdentity, m)),
        retired: true
      });
    })(TestResultItem || (TestResultItem = {}));
    (function(ICoverageCount2) {
      ICoverageCount2.empty = () => ({ covered: 0, total: 0 });
      ICoverageCount2.sum = (target, src) => {
        target.covered += src.covered;
        target.total += src.total;
      };
    })(ICoverageCount || (ICoverageCount = {}));
    (function(IFileCoverage2) {
      IFileCoverage2.serialize = (original) => ({
        id: original.id,
        statement: original.statement,
        branch: original.branch,
        declaration: original.declaration,
        testIds: original.testIds,
        uri: original.uri.toJSON()
      });
      IFileCoverage2.deserialize = (uriIdentity, serialized) => ({
        id: serialized.id,
        statement: serialized.statement,
        branch: serialized.branch,
        declaration: serialized.declaration,
        testIds: serialized.testIds,
        uri: uriIdentity.asCanonicalUri(URI.revive(serialized.uri))
      });
      IFileCoverage2.empty = (id2, uri) => ({
        id: id2,
        uri,
        statement: ICoverageCount.empty()
      });
    })(IFileCoverage || (IFileCoverage = {}));
    (function(DetailType2) {
      DetailType2[DetailType2["Declaration"] = 0] = "Declaration";
      DetailType2[DetailType2["Statement"] = 1] = "Statement";
      DetailType2[DetailType2["Branch"] = 2] = "Branch";
    })(DetailType || (DetailType = {}));
    (function(CoverageDetails2) {
      CoverageDetails2.serialize = (original) => original.type === 0 ? IDeclarationCoverage.serialize(original) : IStatementCoverage.serialize(original);
      CoverageDetails2.deserialize = (serialized) => serialized.type === 0 ? IDeclarationCoverage.deserialize(serialized) : IStatementCoverage.deserialize(serialized);
    })(CoverageDetails || (CoverageDetails = {}));
    (function(IBranchCoverage2) {
      IBranchCoverage2.serialize = serializeThingWithLocation;
      IBranchCoverage2.deserialize = deserializeThingWithLocation;
    })(IBranchCoverage || (IBranchCoverage = {}));
    (function(IDeclarationCoverage2) {
      IDeclarationCoverage2.serialize = serializeThingWithLocation;
      IDeclarationCoverage2.deserialize = deserializeThingWithLocation;
    })(IDeclarationCoverage || (IDeclarationCoverage = {}));
    (function(IStatementCoverage2) {
      IStatementCoverage2.serialize = (original) => ({
        ...serializeThingWithLocation(original),
        branches: original.branches?.map(IBranchCoverage.serialize)
      });
      IStatementCoverage2.deserialize = (serialized) => ({
        ...deserializeThingWithLocation(serialized),
        branches: serialized.branches?.map(IBranchCoverage.deserialize)
      });
    })(IStatementCoverage || (IStatementCoverage = {}));
    (function(TestDiffOpType2) {
      TestDiffOpType2[TestDiffOpType2["Add"] = 0] = "Add";
      TestDiffOpType2[TestDiffOpType2["Update"] = 1] = "Update";
      TestDiffOpType2[TestDiffOpType2["DocumentSynced"] = 2] = "DocumentSynced";
      TestDiffOpType2[TestDiffOpType2["Remove"] = 3] = "Remove";
      TestDiffOpType2[TestDiffOpType2["IncrementPendingExtHosts"] = 4] = "IncrementPendingExtHosts";
      TestDiffOpType2[TestDiffOpType2["Retire"] = 5] = "Retire";
      TestDiffOpType2[TestDiffOpType2["AddTag"] = 6] = "AddTag";
      TestDiffOpType2[TestDiffOpType2["RemoveTag"] = 7] = "RemoveTag";
    })(TestDiffOpType || (TestDiffOpType = {}));
    (function(TestsDiffOp2) {
      TestsDiffOp2.deserialize = (uriIdentity, u) => {
        if (u.op === 0) {
          return { op: u.op, item: InternalTestItem.deserialize(uriIdentity, u.item) };
        } else if (u.op === 1) {
          return { op: u.op, item: ITestItemUpdate.deserialize(u.item) };
        } else if (u.op === 2) {
          return { op: u.op, uri: uriIdentity.asCanonicalUri(URI.revive(u.uri)), docv: u.docv };
        } else {
          return u;
        }
      };
      TestsDiffOp2.serialize = (u) => {
        if (u.op === 0) {
          return { op: u.op, item: InternalTestItem.serialize(u.item) };
        } else if (u.op === 1) {
          return { op: u.op, item: ITestItemUpdate.serialize(u.item) };
        } else {
          return u;
        }
      };
    })(TestsDiffOp || (TestsDiffOp = {}));
  }
});

// out-build/vs/workbench/services/editor/common/editorGroupsService.js
var $iJ, GroupDirection, GroupOrientation, GroupLocation, GroupsArrangement, MergeGroupMode, GroupsOrder, OpenEditorContext;
var init_editorGroupsService = __esm({
  "out-build/vs/workbench/services/editor/common/editorGroupsService.js"() {
    "use strict";
    init_instantiation();
    init_editor();
    $iJ = $Qk("editorGroupsService");
    (function(GroupDirection2) {
      GroupDirection2[GroupDirection2["UP"] = 0] = "UP";
      GroupDirection2[GroupDirection2["DOWN"] = 1] = "DOWN";
      GroupDirection2[GroupDirection2["LEFT"] = 2] = "LEFT";
      GroupDirection2[GroupDirection2["RIGHT"] = 3] = "RIGHT";
    })(GroupDirection || (GroupDirection = {}));
    (function(GroupOrientation2) {
      GroupOrientation2[GroupOrientation2["HORIZONTAL"] = 0] = "HORIZONTAL";
      GroupOrientation2[GroupOrientation2["VERTICAL"] = 1] = "VERTICAL";
    })(GroupOrientation || (GroupOrientation = {}));
    (function(GroupLocation2) {
      GroupLocation2[GroupLocation2["FIRST"] = 0] = "FIRST";
      GroupLocation2[GroupLocation2["LAST"] = 1] = "LAST";
      GroupLocation2[GroupLocation2["NEXT"] = 2] = "NEXT";
      GroupLocation2[GroupLocation2["PREVIOUS"] = 3] = "PREVIOUS";
    })(GroupLocation || (GroupLocation = {}));
    (function(GroupsArrangement2) {
      GroupsArrangement2[GroupsArrangement2["MAXIMIZE"] = 0] = "MAXIMIZE";
      GroupsArrangement2[GroupsArrangement2["EXPAND"] = 1] = "EXPAND";
      GroupsArrangement2[GroupsArrangement2["EVEN"] = 2] = "EVEN";
    })(GroupsArrangement || (GroupsArrangement = {}));
    (function(MergeGroupMode2) {
      MergeGroupMode2[MergeGroupMode2["COPY_EDITORS"] = 0] = "COPY_EDITORS";
      MergeGroupMode2[MergeGroupMode2["MOVE_EDITORS"] = 1] = "MOVE_EDITORS";
    })(MergeGroupMode || (MergeGroupMode = {}));
    (function(GroupsOrder2) {
      GroupsOrder2[GroupsOrder2["CREATION_TIME"] = 0] = "CREATION_TIME";
      GroupsOrder2[GroupsOrder2["MOST_RECENTLY_ACTIVE"] = 1] = "MOST_RECENTLY_ACTIVE";
      GroupsOrder2[GroupsOrder2["GRID_APPEARANCE"] = 2] = "GRID_APPEARANCE";
    })(GroupsOrder || (GroupsOrder = {}));
    (function(OpenEditorContext2) {
      OpenEditorContext2[OpenEditorContext2["NEW_EDITOR"] = 1] = "NEW_EDITOR";
      OpenEditorContext2[OpenEditorContext2["MOVE_EDITOR"] = 2] = "MOVE_EDITOR";
      OpenEditorContext2[OpenEditorContext2["COPY_EDITOR"] = 3] = "COPY_EDITOR";
    })(OpenEditorContext || (OpenEditorContext = {}));
  }
});

// out-build/vs/workbench/services/editor/common/editorService.js
var $mJ, $nJ, $oJ;
var init_editorService = __esm({
  "out-build/vs/workbench/services/editor/common/editorService.js"() {
    "use strict";
    init_instantiation();
    init_editorGroupsService();
    $mJ = $Qk("editorService");
    $nJ = -1;
    $oJ = -2;
  }
});

// out-build/vs/workbench/contrib/testing/common/testItemCollection.js
var TestItemEventOp, strictEqualComparator, diffableProps, diffableEntries, $0V, $$V, $_V, $aW;
var init_testItemCollection = __esm({
  "out-build/vs/workbench/contrib/testing/common/testItemCollection.js"() {
    "use strict";
    init_async();
    init_event();
    init_lifecycle();
    init_assert();
    init_testTypes();
    init_testId();
    (function(TestItemEventOp2) {
      TestItemEventOp2[TestItemEventOp2["Upsert"] = 0] = "Upsert";
      TestItemEventOp2[TestItemEventOp2["SetTags"] = 1] = "SetTags";
      TestItemEventOp2[TestItemEventOp2["UpdateCanResolveChildren"] = 2] = "UpdateCanResolveChildren";
      TestItemEventOp2[TestItemEventOp2["RemoveChild"] = 3] = "RemoveChild";
      TestItemEventOp2[TestItemEventOp2["SetProp"] = 4] = "SetProp";
      TestItemEventOp2[TestItemEventOp2["Bulk"] = 5] = "Bulk";
      TestItemEventOp2[TestItemEventOp2["DocumentSynced"] = 6] = "DocumentSynced";
    })(TestItemEventOp || (TestItemEventOp = {}));
    strictEqualComparator = (a, b) => a === b;
    diffableProps = {
      range: (a, b) => {
        if (a === b) {
          return true;
        }
        if (!a || !b) {
          return false;
        }
        return a.equalsRange(b);
      },
      busy: strictEqualComparator,
      label: strictEqualComparator,
      description: strictEqualComparator,
      error: strictEqualComparator,
      sortText: strictEqualComparator,
      tags: (a, b) => {
        if (a.length !== b.length) {
          return false;
        }
        if (a.some((t1) => !b.includes(t1))) {
          return false;
        }
        return true;
      }
    };
    diffableEntries = Object.entries(diffableProps);
    $0V = class extends Error {
      constructor(id2) {
        super(`Attempted to insert a duplicate test item ID ${id2}`);
      }
    };
    $$V = class extends Error {
      constructor(id2) {
        super(`TestItem with ID "${id2}" is invalid. Make sure to create it from the createTestItem method.`);
      }
    };
    $_V = class extends Error {
      constructor(id2, ctrlA, ctrlB) {
        super(`TestItem with ID "${id2}" is from controller "${ctrlA}" and cannot be added as a child of an item from controller "${ctrlB}".`);
      }
    };
    $aW = (api, getApi, checkCtor) => {
      let mapped = /* @__PURE__ */ new Map();
      return {
        /** @inheritdoc */
        get size() {
          return mapped.size;
        },
        /** @inheritdoc */
        forEach(callback, thisArg) {
          for (const item of mapped.values()) {
            callback.call(thisArg, item, this);
          }
        },
        /** @inheritdoc */
        [Symbol.iterator]() {
          return mapped.entries();
        },
        /** @inheritdoc */
        replace(items) {
          const newMapped = /* @__PURE__ */ new Map();
          const toDelete = new Set(mapped.keys());
          const bulk = { op: 5, ops: [] };
          for (const item of items) {
            if (!(item instanceof checkCtor)) {
              throw new $$V(item.id);
            }
            const itemController = getApi(item).controllerId;
            if (itemController !== api.controllerId) {
              throw new $_V(item.id, itemController, api.controllerId);
            }
            if (newMapped.has(item.id)) {
              throw new $0V(item.id);
            }
            newMapped.set(item.id, item);
            toDelete.delete(item.id);
            bulk.ops.push({ op: 0, item });
          }
          for (const id2 of toDelete.keys()) {
            bulk.ops.push({ op: 3, id: id2 });
          }
          api.listener?.(bulk);
          mapped = newMapped;
        },
        /** @inheritdoc */
        add(item) {
          if (!(item instanceof checkCtor)) {
            throw new $$V(item.id);
          }
          mapped.set(item.id, item);
          api.listener?.({ op: 0, item });
        },
        /** @inheritdoc */
        delete(id2) {
          if (mapped.delete(id2)) {
            api.listener?.({ op: 3, id: id2 });
          }
        },
        /** @inheritdoc */
        get(itemId) {
          return mapped.get(itemId);
        },
        /** JSON serialization function. */
        toJSON() {
          return Array.from(mapped.values());
        }
      };
    };
  }
});

// out-build/vs/workbench/api/common/extHostTestingPrivateApi.js
var eventPrivateApis, $bW, $cW;
var init_extHostTestingPrivateApi = __esm({
  "out-build/vs/workbench/api/common/extHostTestingPrivateApi.js"() {
    "use strict";
    init_testItemCollection();
    eventPrivateApis = /* @__PURE__ */ new WeakMap();
    $bW = (impl, controllerId) => {
      const api = { controllerId };
      eventPrivateApis.set(impl, api);
      return api;
    };
    $cW = (impl) => {
      const api = eventPrivateApis.get(impl);
      if (!api) {
        throw new $$V(impl?.id || "<unknown>");
      }
      return api;
    };
  }
});

// out-build/vs/workbench/api/common/extHostTypeConverters.js
function $fW(value) {
  if (typeof value === "undefined") {
    return value;
  }
  if (typeof value === "string") {
    return URI.file(value);
  } else {
    return value;
  }
}
var Selection, Range2, Location, TokenType2, Position, DocumentSelector, DiagnosticTag2, Diagnostic, DiagnosticRelatedInformation, DiagnosticSeverity2, ViewColumn2, MarkdownString, ThemableDecorationAttachmentRenderOptions, ThemableDecorationRenderOptions, DecorationRangeBehavior2, DecorationRenderOptions, TextEdit, WorkspaceEdit, SymbolKind3, SymbolTag3, WorkspaceSymbol, DocumentSymbol, CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall, location, DefinitionLink, Hover, EvaluatableExpression, InlineValue, InlineValueContext, DocumentHighlight, MultiDocumentHighlight, CompletionTriggerKind3, CompletionContext, CompletionItemTag3, CompletionItemKind3, CompletionItem, ParameterInformation, SignatureInformation, SignatureHelp, InlayHint, InlayHintLabelPart, InlayHintKind3, DocumentLink, ColorPresentation, Color, SelectionRange, TextDocumentSaveReason2, TextEditorLineNumbersStyle2, EndOfLine2, ProgressLocation2, FoldingRange, FoldingRangeKind2, TextEditorOpenOptions, GlobPattern, LanguageSelector, MappedEditsContext, DocumentContextItem, NotebookRange, NotebookCellExecutionSummary, NotebookCellExecutionState3, NotebookCellKind2, NotebookData, NotebookCellData, NotebookCellOutputItem, NotebookCellOutput, NotebookExclusiveDocumentPattern, NotebookStatusBarItem, NotebookKernelSourceAction, NotebookDocumentContentOptions, NotebookRendererScript, TestMessage, TestTag, TestRunProfile, TestRunProfileKind2, TestItem, TestResults, TestCoverage, CodeActionTriggerKind2, TypeHierarchyItem, ViewBadge2, DataTransferItem, DataTransfer, ChatFollowup, LanguageModelChatMessageRole2, LanguageModelChatMessage, ChatResponseMarkdownPart, ChatResponseCodeblockUriPart, ChatResponseMarkdownWithVulnerabilitiesPart, ChatResponseDetectedParticipantPart, ChatResponseConfirmationPart, ChatResponseFilesPart, ChatResponseAnchorPart, ChatResponseProgressPart, ChatResponseWarningPart, ChatResponseMovePart, ChatTask, ChatTaskResult, ChatResponseCommandButtonPart, ChatResponseTextEditPart, ChatResponseReferencePart, ChatResponseCodeCitationPart, ChatResponsePart, ChatAgentRequest, ChatRequestDraft, ChatLocation2, ChatPromptReference, ChatLanguageModelToolReference, ChatAgentCompletionItem, ChatAgentResult, ChatAgentUserActionEvent, TerminalQuickFix, PartialAcceptInfo, PartialAcceptTriggerKind3, DebugTreeItem, LanguageModelToolDescription, LanguageModelToolResult;
var init_extHostTypeConverters = __esm({
  "out-build/vs/workbench/api/common/extHostTypeConverters.js"() {
    "use strict";
    init_arrays();
    init_buffer();
    init_dataTransfer();
    init_functional();
    init_htmlContent();
    init_map();
    init_marked();
    init_marshalling();
    init_mime();
    init_objects();
    init_prefixTree();
    init_resources();
    init_themables();
    init_types();
    init_uri();
    init_range();
    init_languages();
    init_markers();
    init_editor();
    init_chatAgents();
    init_notebookCommon();
    init_testId();
    init_testTypes();
    init_editorService();
    init_extHostTestingPrivateApi();
    init_extHostTypes();
    init_extHostTypes();
    (function(Selection2) {
      function to(selection) {
        const { selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn } = selection;
        const start = new $AT(selectionStartLineNumber - 1, selectionStartColumn - 1);
        const end = new $AT(positionLineNumber - 1, positionColumn - 1);
        return new $CT(start, end);
      }
      Selection2.to = to;
      function from(selection) {
        const { anchor, active } = selection;
        return {
          selectionStartLineNumber: anchor.line + 1,
          selectionStartColumn: anchor.character + 1,
          positionLineNumber: active.line + 1,
          positionColumn: active.character + 1
        };
      }
      Selection2.from = from;
    })(Selection || (Selection = {}));
    (function(Range3) {
      function from(range) {
        if (!range) {
          return void 0;
        }
        const { start, end } = range;
        return {
          startLineNumber: start.line + 1,
          startColumn: start.character + 1,
          endLineNumber: end.line + 1,
          endColumn: end.character + 1
        };
      }
      Range3.from = from;
      function to(range) {
        if (!range) {
          return void 0;
        }
        const { startLineNumber, startColumn, endLineNumber, endColumn } = range;
        return new $BT(startLineNumber - 1, startColumn - 1, endLineNumber - 1, endColumn - 1);
      }
      Range3.to = to;
    })(Range2 || (Range2 = {}));
    (function(Location2) {
      function from(location2) {
        return {
          uri: location2.uri,
          range: Range2.from(location2.range)
        };
      }
      Location2.from = from;
      function to(location2) {
        return new $NT(URI.revive(location2.uri), Range2.to(location2.range));
      }
      Location2.to = to;
    })(Location || (Location = {}));
    (function(TokenType3) {
      function to(type2) {
        switch (type2) {
          case 1:
            return StandardTokenType.Comment;
          case 0:
            return StandardTokenType.Other;
          case 3:
            return StandardTokenType.RegEx;
          case 2:
            return StandardTokenType.String;
        }
      }
      TokenType3.to = to;
    })(TokenType2 || (TokenType2 = {}));
    (function(Position2) {
      function to(position) {
        return new $AT(position.lineNumber - 1, position.column - 1);
      }
      Position2.to = to;
      function from(position) {
        return { lineNumber: position.line + 1, column: position.character + 1 };
      }
      Position2.from = from;
    })(Position || (Position = {}));
    (function(DocumentSelector2) {
      function from(value, uriTransformer, extension) {
        return $Mb($5b(value).map((sel) => _doTransformDocumentSelector(sel, uriTransformer, extension)));
      }
      DocumentSelector2.from = from;
      function _doTransformDocumentSelector(selector, uriTransformer, extension) {
        if (typeof selector === "string") {
          return {
            $serialized: true,
            language: selector,
            isBuiltin: extension?.isBuiltin
          };
        }
        if (selector) {
          return {
            $serialized: true,
            language: selector.language,
            scheme: _transformScheme(selector.scheme, uriTransformer),
            pattern: GlobPattern.from(selector.pattern) ?? void 0,
            exclusive: selector.exclusive,
            notebookType: selector.notebookType,
            isBuiltin: extension?.isBuiltin
          };
        }
        return void 0;
      }
      function _transformScheme(scheme, uriTransformer) {
        if (uriTransformer && typeof scheme === "string") {
          return uriTransformer.transformOutgoingScheme(scheme);
        }
        return scheme;
      }
    })(DocumentSelector || (DocumentSelector = {}));
    (function(DiagnosticTag3) {
      function from(value) {
        switch (value) {
          case DiagnosticTag.Unnecessary:
            return 1;
          case DiagnosticTag.Deprecated:
            return 2;
        }
        return void 0;
      }
      DiagnosticTag3.from = from;
      function to(value) {
        switch (value) {
          case 1:
            return DiagnosticTag.Unnecessary;
          case 2:
            return DiagnosticTag.Deprecated;
          default:
            return void 0;
        }
      }
      DiagnosticTag3.to = to;
    })(DiagnosticTag2 || (DiagnosticTag2 = {}));
    (function(Diagnostic2) {
      function from(value) {
        let code;
        if (value.code) {
          if ($zg(value.code) || $Dg(value.code)) {
            code = String(value.code);
          } else {
            code = {
              value: String(value.code.value),
              target: value.code.target
            };
          }
        }
        return {
          ...Range2.from(value.range),
          message: value.message,
          source: value.source,
          code,
          severity: DiagnosticSeverity2.from(value.severity),
          relatedInformation: value.relatedInformation && value.relatedInformation.map(DiagnosticRelatedInformation.from),
          tags: Array.isArray(value.tags) ? $Mb(value.tags.map(DiagnosticTag2.from)) : void 0
        };
      }
      Diagnostic2.from = from;
      function to(value) {
        const res = new $PT(Range2.to(value), value.message, DiagnosticSeverity2.to(value.severity));
        res.source = value.source;
        res.code = $zg(value.code) ? value.code : value.code?.value;
        res.relatedInformation = value.relatedInformation && value.relatedInformation.map(DiagnosticRelatedInformation.to);
        res.tags = value.tags && $Mb(value.tags.map(DiagnosticTag2.to));
        return res;
      }
      Diagnostic2.to = to;
    })(Diagnostic || (Diagnostic = {}));
    (function(DiagnosticRelatedInformation2) {
      function from(value) {
        return {
          ...Range2.from(value.location.range),
          message: value.message,
          resource: value.location.uri
        };
      }
      DiagnosticRelatedInformation2.from = from;
      function to(value) {
        return new $OT(new $NT(value.resource, Range2.to(value)), value.message);
      }
      DiagnosticRelatedInformation2.to = to;
    })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
    (function(DiagnosticSeverity3) {
      function from(value) {
        switch (value) {
          case DiagnosticSeverity.Error:
            return MarkerSeverity.Error;
          case DiagnosticSeverity.Warning:
            return MarkerSeverity.Warning;
          case DiagnosticSeverity.Information:
            return MarkerSeverity.Info;
          case DiagnosticSeverity.Hint:
            return MarkerSeverity.Hint;
        }
        return MarkerSeverity.Error;
      }
      DiagnosticSeverity3.from = from;
      function to(value) {
        switch (value) {
          case MarkerSeverity.Info:
            return DiagnosticSeverity.Information;
          case MarkerSeverity.Warning:
            return DiagnosticSeverity.Warning;
          case MarkerSeverity.Error:
            return DiagnosticSeverity.Error;
          case MarkerSeverity.Hint:
            return DiagnosticSeverity.Hint;
          default:
            return DiagnosticSeverity.Error;
        }
      }
      DiagnosticSeverity3.to = to;
    })(DiagnosticSeverity2 || (DiagnosticSeverity2 = {}));
    (function(ViewColumn3) {
      function from(column) {
        if (typeof column === "number" && column >= ViewColumn.One) {
          return column - 1;
        }
        if (column === ViewColumn.Beside) {
          return $oJ;
        }
        return $nJ;
      }
      ViewColumn3.from = from;
      function to(position) {
        if (typeof position === "number" && position >= 0) {
          return position + 1;
        }
        throw new Error(`invalid 'EditorGroupColumn'`);
      }
      ViewColumn3.to = to;
    })(ViewColumn2 || (ViewColumn2 = {}));
    (function(MarkdownString2) {
      function fromMany(markup) {
        return markup.map(MarkdownString2.from);
      }
      MarkdownString2.fromMany = fromMany;
      function isCodeblock(thing) {
        return thing && typeof thing === "object" && typeof thing.language === "string" && typeof thing.value === "string";
      }
      function from(markup) {
        let res;
        if (isCodeblock(markup)) {
          const { language, value } = markup;
          res = { value: "```" + language + "\n" + value + "\n```\n" };
        } else if ($4T.isMarkdownString(markup)) {
          res = { value: markup.value, isTrusted: markup.isTrusted, supportThemeIcons: markup.supportThemeIcons, supportHtml: markup.supportHtml, baseUri: markup.baseUri };
        } else if (typeof markup === "string") {
          res = { value: markup };
        } else {
          res = { value: "" };
        }
        const resUris = /* @__PURE__ */ Object.create(null);
        res.uris = resUris;
        const collectUri = ({ href }) => {
          try {
            let uri = URI.parse(href, true);
            uri = uri.with({ query: _uriMassage(uri.query, resUris) });
            resUris[href] = uri;
          } catch (e) {
          }
          return "";
        };
        marked.walkTokens(marked.lexer(res.value), (token) => {
          if (token.type === "link") {
            collectUri({ href: token.href });
          } else if (token.type === "image") {
            if (typeof token.href === "string") {
              collectUri($jm(token.href));
            }
          }
        });
        return res;
      }
      MarkdownString2.from = from;
      function _uriMassage(part, bucket) {
        if (!part) {
          return part;
        }
        let data;
        try {
          data = $bu(part);
        } catch (e) {
        }
        if (!data) {
          return part;
        }
        let changed = false;
        data = $Nv(data, (value) => {
          if (URI.isUri(value)) {
            const key = `__uri_${Math.random().toString(16).slice(2, 8)}`;
            bucket[key] = value;
            changed = true;
            return key;
          } else {
            return void 0;
          }
        });
        if (!changed) {
          return part;
        }
        return JSON.stringify(data);
      }
      function to(value) {
        const result = new $4T(value.value, value.supportThemeIcons);
        result.isTrusted = value.isTrusted;
        result.supportHtml = value.supportHtml;
        result.baseUri = value.baseUri ? URI.from(value.baseUri) : void 0;
        return result;
      }
      MarkdownString2.to = to;
      function fromStrict(value) {
        if (!value) {
          return void 0;
        }
        return typeof value === "string" ? value : MarkdownString2.from(value);
      }
      MarkdownString2.fromStrict = fromStrict;
    })(MarkdownString || (MarkdownString = {}));
    (function(ThemableDecorationAttachmentRenderOptions2) {
      function from(options2) {
        if (typeof options2 === "undefined") {
          return options2;
        }
        return {
          contentText: options2.contentText,
          contentIconPath: options2.contentIconPath ? $fW(options2.contentIconPath) : void 0,
          border: options2.border,
          borderColor: options2.borderColor,
          fontStyle: options2.fontStyle,
          fontWeight: options2.fontWeight,
          textDecoration: options2.textDecoration,
          color: options2.color,
          backgroundColor: options2.backgroundColor,
          margin: options2.margin,
          width: options2.width,
          height: options2.height
        };
      }
      ThemableDecorationAttachmentRenderOptions2.from = from;
    })(ThemableDecorationAttachmentRenderOptions || (ThemableDecorationAttachmentRenderOptions = {}));
    (function(ThemableDecorationRenderOptions2) {
      function from(options2) {
        if (typeof options2 === "undefined") {
          return options2;
        }
        return {
          backgroundColor: options2.backgroundColor,
          outline: options2.outline,
          outlineColor: options2.outlineColor,
          outlineStyle: options2.outlineStyle,
          outlineWidth: options2.outlineWidth,
          border: options2.border,
          borderColor: options2.borderColor,
          borderRadius: options2.borderRadius,
          borderSpacing: options2.borderSpacing,
          borderStyle: options2.borderStyle,
          borderWidth: options2.borderWidth,
          fontStyle: options2.fontStyle,
          fontWeight: options2.fontWeight,
          textDecoration: options2.textDecoration,
          cursor: options2.cursor,
          color: options2.color,
          opacity: options2.opacity,
          letterSpacing: options2.letterSpacing,
          gutterIconPath: options2.gutterIconPath ? $fW(options2.gutterIconPath) : void 0,
          gutterIconSize: options2.gutterIconSize,
          overviewRulerColor: options2.overviewRulerColor,
          before: options2.before ? ThemableDecorationAttachmentRenderOptions.from(options2.before) : void 0,
          after: options2.after ? ThemableDecorationAttachmentRenderOptions.from(options2.after) : void 0
        };
      }
      ThemableDecorationRenderOptions2.from = from;
    })(ThemableDecorationRenderOptions || (ThemableDecorationRenderOptions = {}));
    (function(DecorationRangeBehavior3) {
      function from(value) {
        if (typeof value === "undefined") {
          return value;
        }
        switch (value) {
          case DecorationRangeBehavior.OpenOpen:
            return 0;
          case DecorationRangeBehavior.ClosedClosed:
            return 1;
          case DecorationRangeBehavior.OpenClosed:
            return 2;
          case DecorationRangeBehavior.ClosedOpen:
            return 3;
        }
      }
      DecorationRangeBehavior3.from = from;
    })(DecorationRangeBehavior2 || (DecorationRangeBehavior2 = {}));
    (function(DecorationRenderOptions2) {
      function from(options2) {
        return {
          isWholeLine: options2.isWholeLine,
          rangeBehavior: options2.rangeBehavior ? DecorationRangeBehavior2.from(options2.rangeBehavior) : void 0,
          overviewRulerLane: options2.overviewRulerLane,
          light: options2.light ? ThemableDecorationRenderOptions.from(options2.light) : void 0,
          dark: options2.dark ? ThemableDecorationRenderOptions.from(options2.dark) : void 0,
          backgroundColor: options2.backgroundColor,
          outline: options2.outline,
          outlineColor: options2.outlineColor,
          outlineStyle: options2.outlineStyle,
          outlineWidth: options2.outlineWidth,
          border: options2.border,
          borderColor: options2.borderColor,
          borderRadius: options2.borderRadius,
          borderSpacing: options2.borderSpacing,
          borderStyle: options2.borderStyle,
          borderWidth: options2.borderWidth,
          fontStyle: options2.fontStyle,
          fontWeight: options2.fontWeight,
          textDecoration: options2.textDecoration,
          cursor: options2.cursor,
          color: options2.color,
          opacity: options2.opacity,
          letterSpacing: options2.letterSpacing,
          gutterIconPath: options2.gutterIconPath ? $fW(options2.gutterIconPath) : void 0,
          gutterIconSize: options2.gutterIconSize,
          overviewRulerColor: options2.overviewRulerColor,
          before: options2.before ? ThemableDecorationAttachmentRenderOptions.from(options2.before) : void 0,
          after: options2.after ? ThemableDecorationAttachmentRenderOptions.from(options2.after) : void 0
        };
      }
      DecorationRenderOptions2.from = from;
    })(DecorationRenderOptions || (DecorationRenderOptions = {}));
    (function(TextEdit2) {
      function from(edit2) {
        return {
          text: edit2.newText,
          eol: edit2.newEol && EndOfLine2.from(edit2.newEol),
          range: Range2.from(edit2.range)
        };
      }
      TextEdit2.from = from;
      function to(edit2) {
        const result = new $IT(Range2.to(edit2.range), edit2.text);
        result.newEol = typeof edit2.eol === "undefined" ? void 0 : EndOfLine2.to(edit2.eol);
        return result;
      }
      TextEdit2.to = to;
    })(TextEdit || (TextEdit = {}));
    (function(WorkspaceEdit2) {
      function from(value, versionInfo) {
        const result = {
          edits: []
        };
        if (value instanceof $LT) {
          const toCreate = new $Fc();
          for (const entry of value._allEntries()) {
            if (entry._type === 1 && URI.isUri(entry.to) && entry.from === void 0) {
              toCreate.add(entry.to);
            }
          }
          for (const entry of value._allEntries()) {
            if (entry._type === 1) {
              let contents;
              if (entry.options?.contents) {
                if (ArrayBuffer.isView(entry.options.contents)) {
                  contents = { type: "base64", value: $Wi($Ci.wrap(entry.options.contents)) };
                } else {
                  contents = { type: "dataTransferItem", id: entry.options.contents._itemId };
                }
              }
              result.edits.push({
                oldResource: entry.from,
                newResource: entry.to,
                options: { ...entry.options, contents },
                metadata: entry.metadata
              });
            } else if (entry._type === 2) {
              result.edits.push({
                resource: entry.uri,
                textEdit: TextEdit.from(entry.edit),
                versionId: !toCreate.has(entry.uri) ? versionInfo?.getTextDocumentVersion(entry.uri) : void 0,
                metadata: entry.metadata
              });
            } else if (entry._type === 6) {
              result.edits.push({
                resource: entry.uri,
                textEdit: {
                  range: Range2.from(entry.range),
                  text: entry.edit.value,
                  insertAsSnippet: true
                },
                versionId: !toCreate.has(entry.uri) ? versionInfo?.getTextDocumentVersion(entry.uri) : void 0,
                metadata: entry.metadata
              });
            } else if (entry._type === 3) {
              result.edits.push({
                metadata: entry.metadata,
                resource: entry.uri,
                cellEdit: entry.edit,
                notebookVersionId: versionInfo?.getNotebookDocumentVersion(entry.uri)
              });
            } else if (entry._type === 5) {
              result.edits.push({
                metadata: entry.metadata,
                resource: entry.uri,
                notebookVersionId: versionInfo?.getNotebookDocumentVersion(entry.uri),
                cellEdit: {
                  editType: 1,
                  index: entry.index,
                  count: entry.count,
                  cells: entry.cells.map(NotebookCellData.from)
                }
              });
            }
          }
        }
        return result;
      }
      WorkspaceEdit2.from = from;
      function to(value) {
        const result = new $LT();
        const edits = new $Ec();
        for (const edit2 of value.edits) {
          if (edit2.textEdit) {
            const item = edit2;
            const uri = URI.revive(item.resource);
            const range = Range2.to(item.textEdit.range);
            const text = item.textEdit.text;
            const isSnippet = item.textEdit.insertAsSnippet;
            let editOrSnippetTest;
            if (isSnippet) {
              editOrSnippetTest = $KT.replace(range, new $MT(text));
            } else {
              editOrSnippetTest = $IT.replace(range, text);
            }
            const array = edits.get(uri);
            if (!array) {
              edits.set(uri, [editOrSnippetTest]);
            } else {
              array.push(editOrSnippetTest);
            }
          } else {
            result.renameFile(URI.revive(edit2.oldResource), URI.revive(edit2.newResource), edit2.options);
          }
        }
        for (const [uri, array] of edits) {
          result.set(uri, array);
        }
        return result;
      }
      WorkspaceEdit2.to = to;
    })(WorkspaceEdit || (WorkspaceEdit = {}));
    (function(SymbolKind4) {
      const _fromMapping = /* @__PURE__ */ Object.create(null);
      _fromMapping[SymbolKind.File] = 0;
      _fromMapping[SymbolKind.Module] = 1;
      _fromMapping[SymbolKind.Namespace] = 2;
      _fromMapping[SymbolKind.Package] = 3;
      _fromMapping[SymbolKind.Class] = 4;
      _fromMapping[SymbolKind.Method] = 5;
      _fromMapping[SymbolKind.Property] = 6;
      _fromMapping[SymbolKind.Field] = 7;
      _fromMapping[SymbolKind.Constructor] = 8;
      _fromMapping[SymbolKind.Enum] = 9;
      _fromMapping[SymbolKind.Interface] = 10;
      _fromMapping[SymbolKind.Function] = 11;
      _fromMapping[SymbolKind.Variable] = 12;
      _fromMapping[SymbolKind.Constant] = 13;
      _fromMapping[SymbolKind.String] = 14;
      _fromMapping[SymbolKind.Number] = 15;
      _fromMapping[SymbolKind.Boolean] = 16;
      _fromMapping[SymbolKind.Array] = 17;
      _fromMapping[SymbolKind.Object] = 18;
      _fromMapping[SymbolKind.Key] = 19;
      _fromMapping[SymbolKind.Null] = 20;
      _fromMapping[SymbolKind.EnumMember] = 21;
      _fromMapping[SymbolKind.Struct] = 22;
      _fromMapping[SymbolKind.Event] = 23;
      _fromMapping[SymbolKind.Operator] = 24;
      _fromMapping[SymbolKind.TypeParameter] = 25;
      function from(kind) {
        return typeof _fromMapping[kind] === "number" ? _fromMapping[kind] : 6;
      }
      SymbolKind4.from = from;
      function to(kind) {
        for (const k in _fromMapping) {
          if (_fromMapping[k] === kind) {
            return Number(k);
          }
        }
        return SymbolKind.Property;
      }
      SymbolKind4.to = to;
    })(SymbolKind3 || (SymbolKind3 = {}));
    (function(SymbolTag4) {
      function from(kind) {
        switch (kind) {
          case SymbolTag.Deprecated:
            return 1;
        }
      }
      SymbolTag4.from = from;
      function to(kind) {
        switch (kind) {
          case 1:
            return SymbolTag.Deprecated;
        }
      }
      SymbolTag4.to = to;
    })(SymbolTag3 || (SymbolTag3 = {}));
    (function(WorkspaceSymbol2) {
      function from(info) {
        return {
          name: info.name,
          kind: SymbolKind3.from(info.kind),
          tags: info.tags && info.tags.map(SymbolTag3.from),
          containerName: info.containerName,
          location: location.from(info.location)
        };
      }
      WorkspaceSymbol2.from = from;
      function to(info) {
        const result = new $UT(info.name, SymbolKind3.to(info.kind), info.containerName, location.to(info.location));
        result.tags = info.tags && info.tags.map(SymbolTag3.to);
        return result;
      }
      WorkspaceSymbol2.to = to;
    })(WorkspaceSymbol || (WorkspaceSymbol = {}));
    (function(DocumentSymbol2) {
      function from(info) {
        const result = {
          name: info.name || "!!MISSING: name!!",
          detail: info.detail,
          range: Range2.from(info.range),
          selectionRange: Range2.from(info.selectionRange),
          kind: SymbolKind3.from(info.kind),
          tags: info.tags?.map(SymbolTag3.from) ?? []
        };
        if (info.children) {
          result.children = info.children.map(from);
        }
        return result;
      }
      DocumentSymbol2.from = from;
      function to(info) {
        const result = new $VT(info.name, info.detail, SymbolKind3.to(info.kind), Range2.to(info.range), Range2.to(info.selectionRange));
        if ($Qb(info.tags)) {
          result.tags = info.tags.map(SymbolTag3.to);
        }
        if (info.children) {
          result.children = info.children.map(to);
        }
        return result;
      }
      DocumentSymbol2.to = to;
    })(DocumentSymbol || (DocumentSymbol = {}));
    (function(CallHierarchyItem2) {
      function to(item) {
        const result = new $ZT(SymbolKind3.to(item.kind), item.name, item.detail || "", URI.revive(item.uri), Range2.to(item.range), Range2.to(item.selectionRange));
        result._sessionId = item._sessionId;
        result._itemId = item._itemId;
        return result;
      }
      CallHierarchyItem2.to = to;
      function from(item, sessionId, itemId) {
        sessionId = sessionId ?? item._sessionId;
        itemId = itemId ?? item._itemId;
        if (sessionId === void 0 || itemId === void 0) {
          throw new Error("invalid item");
        }
        return {
          _sessionId: sessionId,
          _itemId: itemId,
          name: item.name,
          detail: item.detail,
          kind: SymbolKind3.from(item.kind),
          uri: item.uri,
          range: Range2.from(item.range),
          selectionRange: Range2.from(item.selectionRange),
          tags: item.tags?.map(SymbolTag3.from)
        };
      }
      CallHierarchyItem2.from = from;
    })(CallHierarchyItem || (CallHierarchyItem = {}));
    (function(CallHierarchyIncomingCall2) {
      function to(item) {
        return new $1T(CallHierarchyItem.to(item.from), item.fromRanges.map((r) => Range2.to(r)));
      }
      CallHierarchyIncomingCall2.to = to;
    })(CallHierarchyIncomingCall || (CallHierarchyIncomingCall = {}));
    (function(CallHierarchyOutgoingCall2) {
      function to(item) {
        return new $2T(CallHierarchyItem.to(item.to), item.fromRanges.map((r) => Range2.to(r)));
      }
      CallHierarchyOutgoingCall2.to = to;
    })(CallHierarchyOutgoingCall || (CallHierarchyOutgoingCall = {}));
    (function(location2) {
      function from(value) {
        return {
          range: value.range && Range2.from(value.range),
          uri: value.uri
        };
      }
      location2.from = from;
      function to(value) {
        return new $NT(URI.revive(value.uri), Range2.to(value.range));
      }
      location2.to = to;
    })(location || (location = {}));
    (function(DefinitionLink2) {
      function from(value) {
        const definitionLink = value;
        const location2 = value;
        return {
          originSelectionRange: definitionLink.originSelectionRange ? Range2.from(definitionLink.originSelectionRange) : void 0,
          uri: definitionLink.targetUri ? definitionLink.targetUri : location2.uri,
          range: Range2.from(definitionLink.targetRange ? definitionLink.targetRange : location2.range),
          targetSelectionRange: definitionLink.targetSelectionRange ? Range2.from(definitionLink.targetSelectionRange) : void 0
        };
      }
      DefinitionLink2.from = from;
      function to(value) {
        return {
          targetUri: URI.revive(value.uri),
          targetRange: Range2.to(value.range),
          targetSelectionRange: value.targetSelectionRange ? Range2.to(value.targetSelectionRange) : void 0,
          originSelectionRange: value.originSelectionRange ? Range2.to(value.originSelectionRange) : void 0
        };
      }
      DefinitionLink2.to = to;
    })(DefinitionLink || (DefinitionLink = {}));
    (function(Hover2) {
      function from(hover) {
        const convertedHover = {
          range: Range2.from(hover.range),
          contents: MarkdownString.fromMany(hover.contents),
          canIncreaseVerbosity: hover.canIncreaseVerbosity,
          canDecreaseVerbosity: hover.canDecreaseVerbosity
        };
        return convertedHover;
      }
      Hover2.from = from;
      function to(info) {
        const contents = info.contents.map(MarkdownString.to);
        const range = Range2.to(info.range);
        const canIncreaseVerbosity = info.canIncreaseVerbosity;
        const canDecreaseVerbosity = info.canDecreaseVerbosity;
        return new $RT(contents, range, canIncreaseVerbosity, canDecreaseVerbosity);
      }
      Hover2.to = to;
    })(Hover || (Hover = {}));
    (function(EvaluatableExpression2) {
      function from(expression) {
        return {
          range: Range2.from(expression.range),
          expression: expression.expression
        };
      }
      EvaluatableExpression2.from = from;
      function to(info) {
        return new $OU(Range2.to(info.range), info.expression);
      }
      EvaluatableExpression2.to = to;
    })(EvaluatableExpression || (EvaluatableExpression = {}));
    (function(InlineValue2) {
      function from(inlineValue) {
        if (inlineValue instanceof $PU) {
          return {
            type: "text",
            range: Range2.from(inlineValue.range),
            text: inlineValue.text
          };
        } else if (inlineValue instanceof $QU) {
          return {
            type: "variable",
            range: Range2.from(inlineValue.range),
            variableName: inlineValue.variableName,
            caseSensitiveLookup: inlineValue.caseSensitiveLookup
          };
        } else if (inlineValue instanceof $RU) {
          return {
            type: "expression",
            range: Range2.from(inlineValue.range),
            expression: inlineValue.expression
          };
        } else {
          throw new Error(`Unknown 'InlineValue' type`);
        }
      }
      InlineValue2.from = from;
      function to(inlineValue) {
        switch (inlineValue.type) {
          case "text":
            return {
              range: Range2.to(inlineValue.range),
              text: inlineValue.text
            };
          case "variable":
            return {
              range: Range2.to(inlineValue.range),
              variableName: inlineValue.variableName,
              caseSensitiveLookup: inlineValue.caseSensitiveLookup
            };
          case "expression":
            return {
              range: Range2.to(inlineValue.range),
              expression: inlineValue.expression
            };
        }
      }
      InlineValue2.to = to;
    })(InlineValue || (InlineValue = {}));
    (function(InlineValueContext2) {
      function from(inlineValueContext) {
        return {
          frameId: inlineValueContext.frameId,
          stoppedLocation: Range2.from(inlineValueContext.stoppedLocation)
        };
      }
      InlineValueContext2.from = from;
      function to(inlineValueContext) {
        return new $SU(inlineValueContext.frameId, Range2.to(inlineValueContext.stoppedLocation));
      }
      InlineValueContext2.to = to;
    })(InlineValueContext || (InlineValueContext = {}));
    (function(DocumentHighlight2) {
      function from(documentHighlight) {
        return {
          range: Range2.from(documentHighlight.range),
          kind: documentHighlight.kind
        };
      }
      DocumentHighlight2.from = from;
      function to(occurrence) {
        return new $ST(Range2.to(occurrence.range), occurrence.kind);
      }
      DocumentHighlight2.to = to;
    })(DocumentHighlight || (DocumentHighlight = {}));
    (function(MultiDocumentHighlight2) {
      function from(multiDocumentHighlight) {
        return {
          uri: multiDocumentHighlight.uri,
          highlights: multiDocumentHighlight.highlights.map(DocumentHighlight.from)
        };
      }
      MultiDocumentHighlight2.from = from;
      function to(multiDocumentHighlight) {
        return new $TT(URI.revive(multiDocumentHighlight.uri), multiDocumentHighlight.highlights.map(DocumentHighlight.to));
      }
      MultiDocumentHighlight2.to = to;
    })(MultiDocumentHighlight || (MultiDocumentHighlight = {}));
    (function(CompletionTriggerKind4) {
      function to(kind) {
        switch (kind) {
          case 1:
            return CompletionTriggerKind.TriggerCharacter;
          case 2:
            return CompletionTriggerKind.TriggerForIncompleteCompletions;
          case 0:
          default:
            return CompletionTriggerKind.Invoke;
        }
      }
      CompletionTriggerKind4.to = to;
    })(CompletionTriggerKind3 || (CompletionTriggerKind3 = {}));
    (function(CompletionContext2) {
      function to(context) {
        return {
          triggerKind: CompletionTriggerKind3.to(context.triggerKind),
          triggerCharacter: context.triggerCharacter
        };
      }
      CompletionContext2.to = to;
    })(CompletionContext || (CompletionContext = {}));
    (function(CompletionItemTag4) {
      function from(kind) {
        switch (kind) {
          case CompletionItemTag.Deprecated:
            return 1;
        }
      }
      CompletionItemTag4.from = from;
      function to(kind) {
        switch (kind) {
          case 1:
            return CompletionItemTag.Deprecated;
        }
      }
      CompletionItemTag4.to = to;
    })(CompletionItemTag3 || (CompletionItemTag3 = {}));
    (function(CompletionItemKind4) {
      const _from = /* @__PURE__ */ new Map([
        [
          CompletionItemKind.Method,
          0
          /* languages.CompletionItemKind.Method */
        ],
        [
          CompletionItemKind.Function,
          1
          /* languages.CompletionItemKind.Function */
        ],
        [
          CompletionItemKind.Constructor,
          2
          /* languages.CompletionItemKind.Constructor */
        ],
        [
          CompletionItemKind.Field,
          3
          /* languages.CompletionItemKind.Field */
        ],
        [
          CompletionItemKind.Variable,
          4
          /* languages.CompletionItemKind.Variable */
        ],
        [
          CompletionItemKind.Class,
          5
          /* languages.CompletionItemKind.Class */
        ],
        [
          CompletionItemKind.Interface,
          7
          /* languages.CompletionItemKind.Interface */
        ],
        [
          CompletionItemKind.Struct,
          6
          /* languages.CompletionItemKind.Struct */
        ],
        [
          CompletionItemKind.Module,
          8
          /* languages.CompletionItemKind.Module */
        ],
        [
          CompletionItemKind.Property,
          9
          /* languages.CompletionItemKind.Property */
        ],
        [
          CompletionItemKind.Unit,
          12
          /* languages.CompletionItemKind.Unit */
        ],
        [
          CompletionItemKind.Value,
          13
          /* languages.CompletionItemKind.Value */
        ],
        [
          CompletionItemKind.Constant,
          14
          /* languages.CompletionItemKind.Constant */
        ],
        [
          CompletionItemKind.Enum,
          15
          /* languages.CompletionItemKind.Enum */
        ],
        [
          CompletionItemKind.EnumMember,
          16
          /* languages.CompletionItemKind.EnumMember */
        ],
        [
          CompletionItemKind.Keyword,
          17
          /* languages.CompletionItemKind.Keyword */
        ],
        [
          CompletionItemKind.Snippet,
          27
          /* languages.CompletionItemKind.Snippet */
        ],
        [
          CompletionItemKind.Text,
          18
          /* languages.CompletionItemKind.Text */
        ],
        [
          CompletionItemKind.Color,
          19
          /* languages.CompletionItemKind.Color */
        ],
        [
          CompletionItemKind.File,
          20
          /* languages.CompletionItemKind.File */
        ],
        [
          CompletionItemKind.Reference,
          21
          /* languages.CompletionItemKind.Reference */
        ],
        [
          CompletionItemKind.Folder,
          23
          /* languages.CompletionItemKind.Folder */
        ],
        [
          CompletionItemKind.Event,
          10
          /* languages.CompletionItemKind.Event */
        ],
        [
          CompletionItemKind.Operator,
          11
          /* languages.CompletionItemKind.Operator */
        ],
        [
          CompletionItemKind.TypeParameter,
          24
          /* languages.CompletionItemKind.TypeParameter */
        ],
        [
          CompletionItemKind.Issue,
          26
          /* languages.CompletionItemKind.Issue */
        ],
        [
          CompletionItemKind.User,
          25
          /* languages.CompletionItemKind.User */
        ]
      ]);
      function from(kind) {
        return _from.get(kind) ?? 9;
      }
      CompletionItemKind4.from = from;
      const _to = /* @__PURE__ */ new Map([
        [0, CompletionItemKind.Method],
        [1, CompletionItemKind.Function],
        [2, CompletionItemKind.Constructor],
        [3, CompletionItemKind.Field],
        [4, CompletionItemKind.Variable],
        [5, CompletionItemKind.Class],
        [7, CompletionItemKind.Interface],
        [6, CompletionItemKind.Struct],
        [8, CompletionItemKind.Module],
        [9, CompletionItemKind.Property],
        [12, CompletionItemKind.Unit],
        [13, CompletionItemKind.Value],
        [14, CompletionItemKind.Constant],
        [15, CompletionItemKind.Enum],
        [16, CompletionItemKind.EnumMember],
        [17, CompletionItemKind.Keyword],
        [27, CompletionItemKind.Snippet],
        [18, CompletionItemKind.Text],
        [19, CompletionItemKind.Color],
        [20, CompletionItemKind.File],
        [21, CompletionItemKind.Reference],
        [23, CompletionItemKind.Folder],
        [10, CompletionItemKind.Event],
        [11, CompletionItemKind.Operator],
        [24, CompletionItemKind.TypeParameter],
        [25, CompletionItemKind.User],
        [26, CompletionItemKind.Issue]
      ]);
      function to(kind) {
        return _to.get(kind) ?? CompletionItemKind.Property;
      }
      CompletionItemKind4.to = to;
    })(CompletionItemKind3 || (CompletionItemKind3 = {}));
    (function(CompletionItem2) {
      function to(suggestion, converter) {
        const result = new $0T(suggestion.label);
        result.insertText = suggestion.insertText;
        result.kind = CompletionItemKind3.to(suggestion.kind);
        result.tags = suggestion.tags?.map(CompletionItemTag3.to);
        result.detail = suggestion.detail;
        result.documentation = $dm(suggestion.documentation) ? MarkdownString.to(suggestion.documentation) : suggestion.documentation;
        result.sortText = suggestion.sortText;
        result.filterText = suggestion.filterText;
        result.preselect = suggestion.preselect;
        result.commitCharacters = suggestion.commitCharacters;
        if ($9C.isIRange(suggestion.range)) {
          result.range = Range2.to(suggestion.range);
        } else if (typeof suggestion.range === "object") {
          result.range = { inserting: Range2.to(suggestion.range.insert), replacing: Range2.to(suggestion.range.replace) };
        }
        result.keepWhitespace = typeof suggestion.insertTextRules === "undefined" ? false : Boolean(
          suggestion.insertTextRules & 1
          /* languages.CompletionItemInsertTextRule.KeepWhitespace */
        );
        if (typeof suggestion.insertTextRules !== "undefined" && suggestion.insertTextRules & 4) {
          result.insertText = new $MT(suggestion.insertText);
        } else {
          result.insertText = suggestion.insertText;
          result.textEdit = result.range instanceof $BT ? new $IT(result.range, result.insertText) : void 0;
        }
        if (suggestion.additionalTextEdits && suggestion.additionalTextEdits.length > 0) {
          result.additionalTextEdits = suggestion.additionalTextEdits.map((e) => TextEdit.to(e));
        }
        result.command = converter && suggestion.command ? converter.fromInternal(suggestion.command) : void 0;
        return result;
      }
      CompletionItem2.to = to;
    })(CompletionItem || (CompletionItem = {}));
    (function(ParameterInformation2) {
      function from(info) {
        if (typeof info.label !== "string" && !Array.isArray(info.label)) {
          throw new TypeError("Invalid label");
        }
        return {
          label: info.label,
          documentation: MarkdownString.fromStrict(info.documentation)
        };
      }
      ParameterInformation2.from = from;
      function to(info) {
        return {
          label: info.label,
          documentation: $dm(info.documentation) ? MarkdownString.to(info.documentation) : info.documentation
        };
      }
      ParameterInformation2.to = to;
    })(ParameterInformation || (ParameterInformation = {}));
    (function(SignatureInformation2) {
      function from(info) {
        return {
          label: info.label,
          documentation: MarkdownString.fromStrict(info.documentation),
          parameters: Array.isArray(info.parameters) ? info.parameters.map(ParameterInformation.from) : [],
          activeParameter: info.activeParameter
        };
      }
      SignatureInformation2.from = from;
      function to(info) {
        return {
          label: info.label,
          documentation: $dm(info.documentation) ? MarkdownString.to(info.documentation) : info.documentation,
          parameters: Array.isArray(info.parameters) ? info.parameters.map(ParameterInformation.to) : [],
          activeParameter: info.activeParameter
        };
      }
      SignatureInformation2.to = to;
    })(SignatureInformation || (SignatureInformation = {}));
    (function(SignatureHelp2) {
      function from(help) {
        return {
          activeSignature: help.activeSignature,
          activeParameter: help.activeParameter,
          signatures: Array.isArray(help.signatures) ? help.signatures.map(SignatureInformation.from) : []
        };
      }
      SignatureHelp2.from = from;
      function to(help) {
        return {
          activeSignature: help.activeSignature,
          activeParameter: help.activeParameter,
          signatures: Array.isArray(help.signatures) ? help.signatures.map(SignatureInformation.to) : []
        };
      }
      SignatureHelp2.to = to;
    })(SignatureHelp || (SignatureHelp = {}));
    (function(InlayHint2) {
      function to(converter, hint) {
        const res = new $9T(Position.to(hint.position), typeof hint.label === "string" ? hint.label : hint.label.map(InlayHintLabelPart.to.bind(void 0, converter)), hint.kind && InlayHintKind3.to(hint.kind));
        res.textEdits = hint.textEdits && hint.textEdits.map(TextEdit.to);
        res.tooltip = $dm(hint.tooltip) ? MarkdownString.to(hint.tooltip) : hint.tooltip;
        res.paddingLeft = hint.paddingLeft;
        res.paddingRight = hint.paddingRight;
        return res;
      }
      InlayHint2.to = to;
    })(InlayHint || (InlayHint = {}));
    (function(InlayHintLabelPart2) {
      function to(converter, part) {
        const result = new $8T(part.label);
        result.tooltip = $dm(part.tooltip) ? MarkdownString.to(part.tooltip) : part.tooltip;
        if (Command.is(part.command)) {
          result.command = converter.fromInternal(part.command);
        }
        if (part.location) {
          result.location = location.to(part.location);
        }
        return result;
      }
      InlayHintLabelPart2.to = to;
    })(InlayHintLabelPart || (InlayHintLabelPart = {}));
    (function(InlayHintKind4) {
      function from(kind) {
        return kind;
      }
      InlayHintKind4.from = from;
      function to(kind) {
        return kind;
      }
      InlayHintKind4.to = to;
    })(InlayHintKind3 || (InlayHintKind3 = {}));
    (function(DocumentLink2) {
      function from(link2) {
        return {
          range: Range2.from(link2.range),
          url: link2.target,
          tooltip: link2.tooltip
        };
      }
      DocumentLink2.from = from;
      function to(link2) {
        let target = void 0;
        if (link2.url) {
          try {
            target = typeof link2.url === "string" ? URI.parse(link2.url, true) : URI.revive(link2.url);
          } catch (err) {
          }
        }
        const result = new $cU(Range2.to(link2.range), target);
        result.tooltip = link2.tooltip;
        return result;
      }
      DocumentLink2.to = to;
    })(DocumentLink || (DocumentLink = {}));
    (function(ColorPresentation2) {
      function to(colorPresentation) {
        const cp3 = new $fU(colorPresentation.label);
        if (colorPresentation.textEdit) {
          cp3.textEdit = TextEdit.to(colorPresentation.textEdit);
        }
        if (colorPresentation.additionalTextEdits) {
          cp3.additionalTextEdits = colorPresentation.additionalTextEdits.map((value) => TextEdit.to(value));
        }
        return cp3;
      }
      ColorPresentation2.to = to;
      function from(colorPresentation) {
        return {
          label: colorPresentation.label,
          textEdit: colorPresentation.textEdit ? TextEdit.from(colorPresentation.textEdit) : void 0,
          additionalTextEdits: colorPresentation.additionalTextEdits ? colorPresentation.additionalTextEdits.map((value) => TextEdit.from(value)) : void 0
        };
      }
      ColorPresentation2.from = from;
    })(ColorPresentation || (ColorPresentation = {}));
    (function(Color2) {
      function to(c) {
        return new $dU(c[0], c[1], c[2], c[3]);
      }
      Color2.to = to;
      function from(color2) {
        return [color2.red, color2.green, color2.blue, color2.alpha];
      }
      Color2.from = from;
    })(Color || (Color = {}));
    (function(SelectionRange2) {
      function from(obj) {
        return { range: Range2.from(obj.range) };
      }
      SelectionRange2.from = from;
      function to(obj) {
        return new $YT(Range2.to(obj.range));
      }
      SelectionRange2.to = to;
    })(SelectionRange || (SelectionRange = {}));
    (function(TextDocumentSaveReason3) {
      function to(reason) {
        switch (reason) {
          case 2:
            return TextDocumentSaveReason.AfterDelay;
          case 1:
            return TextDocumentSaveReason.Manual;
          case 3:
          case 4:
            return TextDocumentSaveReason.FocusOut;
        }
      }
      TextDocumentSaveReason3.to = to;
    })(TextDocumentSaveReason2 || (TextDocumentSaveReason2 = {}));
    (function(TextEditorLineNumbersStyle3) {
      function from(style) {
        switch (style) {
          case TextEditorLineNumbersStyle.Off:
            return 0;
          case TextEditorLineNumbersStyle.Relative:
            return 2;
          case TextEditorLineNumbersStyle.Interval:
            return 3;
          case TextEditorLineNumbersStyle.On:
          default:
            return 1;
        }
      }
      TextEditorLineNumbersStyle3.from = from;
      function to(style) {
        switch (style) {
          case 0:
            return TextEditorLineNumbersStyle.Off;
          case 2:
            return TextEditorLineNumbersStyle.Relative;
          case 3:
            return TextEditorLineNumbersStyle.Interval;
          case 1:
          default:
            return TextEditorLineNumbersStyle.On;
        }
      }
      TextEditorLineNumbersStyle3.to = to;
    })(TextEditorLineNumbersStyle2 || (TextEditorLineNumbersStyle2 = {}));
    (function(EndOfLine3) {
      function from(eol) {
        if (eol === EndOfLine.CRLF) {
          return 1;
        } else if (eol === EndOfLine.LF) {
          return 0;
        }
        return void 0;
      }
      EndOfLine3.from = from;
      function to(eol) {
        if (eol === 1) {
          return EndOfLine.CRLF;
        } else if (eol === 0) {
          return EndOfLine.LF;
        }
        return void 0;
      }
      EndOfLine3.to = to;
    })(EndOfLine2 || (EndOfLine2 = {}));
    (function(ProgressLocation3) {
      function from(loc) {
        if (typeof loc === "object") {
          return loc.viewId;
        }
        switch (loc) {
          case ProgressLocation.SourceControl:
            return 3;
          case ProgressLocation.Window:
            return 10;
          case ProgressLocation.Notification:
            return 15;
        }
        throw new Error(`Unknown 'ProgressLocation'`);
      }
      ProgressLocation3.from = from;
    })(ProgressLocation2 || (ProgressLocation2 = {}));
    (function(FoldingRange2) {
      function from(r) {
        const range = { start: r.start + 1, end: r.end + 1 };
        if (r.kind) {
          range.kind = FoldingRangeKind2.from(r.kind);
        }
        return range;
      }
      FoldingRange2.from = from;
      function to(r) {
        const range = { start: r.start - 1, end: r.end - 1 };
        if (r.kind) {
          range.kind = FoldingRangeKind2.to(r.kind);
        }
        return range;
      }
      FoldingRange2.to = to;
    })(FoldingRange || (FoldingRange = {}));
    (function(FoldingRangeKind3) {
      function from(kind) {
        if (kind) {
          switch (kind) {
            case FoldingRangeKind.Comment:
              return $WE.Comment;
            case FoldingRangeKind.Imports:
              return $WE.Imports;
            case FoldingRangeKind.Region:
              return $WE.Region;
          }
        }
        return void 0;
      }
      FoldingRangeKind3.from = from;
      function to(kind) {
        if (kind) {
          switch (kind.value) {
            case $WE.Comment.value:
              return FoldingRangeKind.Comment;
            case $WE.Imports.value:
              return FoldingRangeKind.Imports;
            case $WE.Region.value:
              return FoldingRangeKind.Region;
          }
        }
        return void 0;
      }
      FoldingRangeKind3.to = to;
    })(FoldingRangeKind2 || (FoldingRangeKind2 = {}));
    (function(TextEditorOpenOptions2) {
      function from(options2) {
        if (options2) {
          return {
            pinned: typeof options2.preview === "boolean" ? !options2.preview : void 0,
            inactive: options2.background,
            preserveFocus: options2.preserveFocus,
            selection: typeof options2.selection === "object" ? Range2.from(options2.selection) : void 0,
            override: typeof options2.override === "boolean" ? $1K.id : void 0
          };
        }
        return void 0;
      }
      TextEditorOpenOptions2.from = from;
    })(TextEditorOpenOptions || (TextEditorOpenOptions = {}));
    (function(GlobPattern2) {
      function from(pattern) {
        if (pattern instanceof $CU) {
          return pattern.toJSON();
        }
        if (typeof pattern === "string") {
          return pattern;
        }
        if (isRelativePatternShape(pattern) || isLegacyRelativePatternShape(pattern)) {
          return new $CU(pattern.baseUri ?? pattern.base, pattern.pattern).toJSON();
        }
        return pattern;
      }
      GlobPattern2.from = from;
      function isRelativePatternShape(obj) {
        const rp = obj;
        if (!rp) {
          return false;
        }
        return URI.isUri(rp.baseUri) && typeof rp.pattern === "string";
      }
      function isLegacyRelativePatternShape(obj) {
        const rp = obj;
        if (!rp) {
          return false;
        }
        return typeof rp.base === "string" && typeof rp.pattern === "string";
      }
      function to(pattern) {
        if (typeof pattern === "string") {
          return pattern;
        }
        return new $CU(URI.revive(pattern.baseUri), pattern.pattern);
      }
      GlobPattern2.to = to;
    })(GlobPattern || (GlobPattern = {}));
    (function(LanguageSelector2) {
      function from(selector) {
        if (!selector) {
          return void 0;
        } else if (Array.isArray(selector)) {
          return selector.map(from);
        } else if (typeof selector === "string") {
          return selector;
        } else {
          const filter = selector;
          return {
            language: filter.language,
            scheme: filter.scheme,
            pattern: GlobPattern.from(filter.pattern) ?? void 0,
            exclusive: filter.exclusive,
            notebookType: filter.notebookType
          };
        }
      }
      LanguageSelector2.from = from;
    })(LanguageSelector || (LanguageSelector = {}));
    (function(MappedEditsContext2) {
      function is(v) {
        return !!v && typeof v === "object" && "documents" in v && Array.isArray(v.documents) && v.documents.every((subArr) => Array.isArray(subArr) && subArr.every(DocumentContextItem.is));
      }
      MappedEditsContext2.is = is;
      function from(extContext) {
        return {
          documents: extContext.documents.map((subArray) => subArray.map(DocumentContextItem.from)),
          conversation: extContext.conversation?.map((item) => item.type === "request" ? {
            type: "request",
            message: item.message
          } : {
            type: "response",
            message: item.message,
            result: item.result ? ChatAgentResult.from(item.result) : void 0,
            references: item.references?.map(DocumentContextItem.from)
          })
        };
      }
      MappedEditsContext2.from = from;
    })(MappedEditsContext || (MappedEditsContext = {}));
    (function(DocumentContextItem2) {
      function is(item) {
        return typeof item === "object" && item !== null && "uri" in item && URI.isUri(item.uri) && "version" in item && typeof item.version === "number" && "ranges" in item && Array.isArray(item.ranges) && item.ranges.every((r) => r instanceof $BT);
      }
      DocumentContextItem2.is = is;
      function from(item) {
        return {
          uri: item.uri,
          version: item.version,
          ranges: item.ranges.map((r) => Range2.from(r))
        };
      }
      DocumentContextItem2.from = from;
      function to(item) {
        return {
          uri: URI.revive(item.uri),
          version: item.version,
          ranges: item.ranges.map((r) => Range2.to(r))
        };
      }
      DocumentContextItem2.to = to;
    })(DocumentContextItem || (DocumentContextItem = {}));
    (function(NotebookRange2) {
      function from(range) {
        return { start: range.start, end: range.end };
      }
      NotebookRange2.from = from;
      function to(range) {
        return new $6U(range.start, range.end);
      }
      NotebookRange2.to = to;
    })(NotebookRange || (NotebookRange = {}));
    (function(NotebookCellExecutionSummary2) {
      function to(data) {
        return {
          timing: typeof data.runStartTime === "number" && typeof data.runEndTime === "number" ? { startTime: data.runStartTime, endTime: data.runEndTime } : void 0,
          executionOrder: data.executionOrder,
          success: data.lastRunSuccess
        };
      }
      NotebookCellExecutionSummary2.to = to;
      function from(data) {
        return {
          lastRunSuccess: data.success,
          runStartTime: data.timing?.startTime,
          runEndTime: data.timing?.endTime,
          executionOrder: data.executionOrder
        };
      }
      NotebookCellExecutionSummary2.from = from;
    })(NotebookCellExecutionSummary || (NotebookCellExecutionSummary = {}));
    (function(NotebookCellExecutionState4) {
      function to(state) {
        if (state === NotebookCellExecutionState.Unconfirmed) {
          return NotebookCellExecutionState2.Pending;
        } else if (state === NotebookCellExecutionState.Pending) {
          return void 0;
        } else if (state === NotebookCellExecutionState.Executing) {
          return NotebookCellExecutionState2.Executing;
        } else {
          throw new Error(`Unknown state: ${state}`);
        }
      }
      NotebookCellExecutionState4.to = to;
    })(NotebookCellExecutionState3 || (NotebookCellExecutionState3 = {}));
    (function(NotebookCellKind3) {
      function from(data) {
        switch (data) {
          case NotebookCellKind.Markup:
            return CellKind.Markup;
          case NotebookCellKind.Code:
          default:
            return CellKind.Code;
        }
      }
      NotebookCellKind3.from = from;
      function to(data) {
        switch (data) {
          case CellKind.Markup:
            return NotebookCellKind.Markup;
          case CellKind.Code:
          default:
            return NotebookCellKind.Code;
        }
      }
      NotebookCellKind3.to = to;
    })(NotebookCellKind2 || (NotebookCellKind2 = {}));
    (function(NotebookData2) {
      function from(data) {
        const res = {
          metadata: data.metadata ?? /* @__PURE__ */ Object.create(null),
          cells: []
        };
        for (const cell of data.cells) {
          $7U.validate(cell);
          res.cells.push(NotebookCellData.from(cell));
        }
        return res;
      }
      NotebookData2.from = from;
      function to(data) {
        const res = new $8U(data.cells.map(NotebookCellData.to));
        if (!$Mg(data.metadata)) {
          res.metadata = data.metadata;
        }
        return res;
      }
      NotebookData2.to = to;
    })(NotebookData || (NotebookData = {}));
    (function(NotebookCellData2) {
      function from(data) {
        return {
          cellKind: NotebookCellKind2.from(data.kind),
          language: data.languageId,
          mime: data.mime,
          source: data.value,
          metadata: data.metadata,
          internalMetadata: NotebookCellExecutionSummary.from(data.executionSummary ?? {}),
          outputs: data.outputs ? data.outputs.map(NotebookCellOutput.from) : []
        };
      }
      NotebookCellData2.from = from;
      function to(data) {
        return new $7U(NotebookCellKind2.to(data.cellKind), data.source, data.language, data.mime, data.outputs ? data.outputs.map(NotebookCellOutput.to) : void 0, data.metadata, data.internalMetadata ? NotebookCellExecutionSummary.to(data.internalMetadata) : void 0);
      }
      NotebookCellData2.to = to;
    })(NotebookCellData || (NotebookCellData = {}));
    (function(NotebookCellOutputItem2) {
      function from(item) {
        return {
          mime: item.mime,
          valueBytes: $Ci.wrap(item.data)
        };
      }
      NotebookCellOutputItem2.from = from;
      function to(item) {
        return new $9U(item.valueBytes.buffer, item.mime);
      }
      NotebookCellOutputItem2.to = to;
    })(NotebookCellOutputItem || (NotebookCellOutputItem = {}));
    (function(NotebookCellOutput2) {
      function from(output) {
        return {
          outputId: output.id,
          items: output.items.map(NotebookCellOutputItem.from),
          metadata: output.metadata
        };
      }
      NotebookCellOutput2.from = from;
      function to(output) {
        const items = output.items.map(NotebookCellOutputItem.to);
        return new $0U(items, output.outputId, output.metadata);
      }
      NotebookCellOutput2.to = to;
    })(NotebookCellOutput || (NotebookCellOutput = {}));
    (function(NotebookExclusiveDocumentPattern2) {
      function from(pattern) {
        if (isExclusivePattern(pattern)) {
          return {
            include: GlobPattern.from(pattern.include) ?? void 0,
            exclude: GlobPattern.from(pattern.exclude) ?? void 0
          };
        }
        return GlobPattern.from(pattern) ?? void 0;
      }
      NotebookExclusiveDocumentPattern2.from = from;
      function to(pattern) {
        if (isExclusivePattern(pattern)) {
          return {
            include: GlobPattern.to(pattern.include),
            exclude: GlobPattern.to(pattern.exclude)
          };
        }
        return GlobPattern.to(pattern);
      }
      NotebookExclusiveDocumentPattern2.to = to;
      function isExclusivePattern(obj) {
        const ep = obj;
        if (!ep) {
          return false;
        }
        return !$Ig(ep.include) && !$Ig(ep.exclude);
      }
    })(NotebookExclusiveDocumentPattern || (NotebookExclusiveDocumentPattern = {}));
    (function(NotebookStatusBarItem2) {
      function from(item, commandsConverter, disposables) {
        const command = typeof item.command === "string" ? { title: "", command: item.command } : item.command;
        return {
          alignment: item.alignment === NotebookCellStatusBarAlignment.Left ? 1 : 2,
          command: commandsConverter.toInternal(command, disposables),
          // TODO@roblou
          text: item.text,
          tooltip: item.tooltip,
          accessibilityInformation: item.accessibilityInformation,
          priority: item.priority
        };
      }
      NotebookStatusBarItem2.from = from;
    })(NotebookStatusBarItem || (NotebookStatusBarItem = {}));
    (function(NotebookKernelSourceAction2) {
      function from(item, commandsConverter, disposables) {
        const command = typeof item.command === "string" ? { title: "", command: item.command } : item.command;
        return {
          command: commandsConverter.toInternal(command, disposables),
          label: item.label,
          description: item.description,
          detail: item.detail,
          documentation: item.documentation
        };
      }
      NotebookKernelSourceAction2.from = from;
    })(NotebookKernelSourceAction || (NotebookKernelSourceAction = {}));
    (function(NotebookDocumentContentOptions2) {
      function from(options2) {
        return {
          transientOutputs: options2?.transientOutputs ?? false,
          transientCellMetadata: options2?.transientCellMetadata ?? {},
          transientDocumentMetadata: options2?.transientDocumentMetadata ?? {},
          cellContentMetadata: options2?.cellContentMetadata ?? {}
        };
      }
      NotebookDocumentContentOptions2.from = from;
    })(NotebookDocumentContentOptions || (NotebookDocumentContentOptions = {}));
    (function(NotebookRendererScript2) {
      function from(preload) {
        return {
          uri: preload.uri,
          provides: preload.provides
        };
      }
      NotebookRendererScript2.from = from;
      function to(preload) {
        return new $aV(URI.revive(preload.uri), preload.provides);
      }
      NotebookRendererScript2.to = to;
    })(NotebookRendererScript || (NotebookRendererScript = {}));
    (function(TestMessage2) {
      function from(message) {
        return {
          message: MarkdownString.fromStrict(message.message) || "",
          type: 0,
          expected: message.expectedOutput,
          actual: message.actualOutput,
          contextValue: message.contextValue,
          location: message.location && { range: Range2.from(message.location.range), uri: message.location.uri },
          stackTrace: message.stackTrace?.map((s) => ({
            label: s.label,
            position: s.position && Position.from(s.position),
            uri: s.uri && URI.revive(s.uri).toJSON()
          }))
        };
      }
      TestMessage2.from = from;
      function to(item) {
        const message = new $hV(typeof item.message === "string" ? item.message : MarkdownString.to(item.message));
        message.actualOutput = item.actual;
        message.expectedOutput = item.expected;
        message.contextValue = item.contextValue;
        message.location = item.location ? location.to(item.location) : void 0;
        return message;
      }
      TestMessage2.to = to;
    })(TestMessage || (TestMessage = {}));
    (function(TestTag2) {
      TestTag2.namespace = $sQ;
      TestTag2.denamespace = $tQ;
    })(TestTag || (TestTag = {}));
    (function(TestRunProfile2) {
      function from(item) {
        return {
          controllerId: item.controllerId,
          profileId: item.profileId,
          group: TestRunProfileKind2.from(item.kind)
        };
      }
      TestRunProfile2.from = from;
    })(TestRunProfile || (TestRunProfile = {}));
    (function(TestRunProfileKind3) {
      const profileGroupToBitset = {
        [TestRunProfileKind.Coverage]: 8,
        [TestRunProfileKind.Debug]: 4,
        [TestRunProfileKind.Run]: 2
      };
      function from(kind) {
        return profileGroupToBitset.hasOwnProperty(kind) ? profileGroupToBitset[kind] : 2;
      }
      TestRunProfileKind3.from = from;
    })(TestRunProfileKind2 || (TestRunProfileKind2 = {}));
    (function(TestItem2) {
      function from(item) {
        const ctrlId = $cW(item).controllerId;
        return {
          extId: $mQ.fromExtHostTestItem(item, ctrlId).toString(),
          label: item.label,
          uri: URI.revive(item.uri),
          busy: item.busy,
          tags: item.tags.map((t) => TestTag.namespace(ctrlId, t.id)),
          range: $9C.lift(Range2.from(item.range)),
          description: item.description || null,
          sortText: item.sortText || null,
          error: item.error ? MarkdownString.fromStrict(item.error) || null : null
        };
      }
      TestItem2.from = from;
      function toPlain(item) {
        return {
          parent: void 0,
          error: void 0,
          id: $mQ.fromString(item.extId).localId,
          label: item.label,
          uri: URI.revive(item.uri),
          tags: (item.tags || []).map((t) => {
            const { tagId } = TestTag.denamespace(t);
            return new $iV(tagId);
          }),
          children: {
            add: () => {
            },
            delete: () => {
            },
            forEach: () => {
            },
            *[Symbol.iterator]() {
            },
            get: () => void 0,
            replace: () => {
            },
            size: 0
          },
          range: Range2.to(item.range || void 0),
          canResolveChildren: false,
          busy: item.busy,
          description: item.description || void 0,
          sortText: item.sortText || void 0
        };
      }
      TestItem2.toPlain = toPlain;
    })(TestItem || (TestItem = {}));
    (function(TestTag2) {
      function from(tag2) {
        return { id: tag2.id };
      }
      TestTag2.from = from;
      function to(tag2) {
        return new $iV(tag2.id);
      }
      TestTag2.to = to;
    })(TestTag || (TestTag = {}));
    (function(TestResults2) {
      const convertTestResultItem = (node, parent) => {
        const item = node.value;
        if (!item) {
          return void 0;
        }
        const snapshot = {
          ...TestItem.toPlain(item.item),
          parent,
          taskStates: item.tasks.map((t) => ({
            state: t.state,
            duration: t.duration,
            messages: t.messages.filter(
              (m) => m.type === 0
              /* TestMessageType.Error */
            ).map(TestMessage.to)
          })),
          children: []
        };
        if (node.children) {
          for (const child of node.children.values()) {
            const c = convertTestResultItem(child, snapshot);
            if (c) {
              snapshot.children.push(c);
            }
          }
        }
        return snapshot;
      };
      function to(serialized) {
        const tree = new $lQ();
        for (const item of serialized.items) {
          tree.insert($mQ.fromString(item.item.extId).path, item);
        }
        const queue = [tree.nodes];
        const roots = [];
        while (queue.length) {
          for (const node of queue.pop()) {
            if (node.value) {
              roots.push(node);
            } else if (node.children) {
              queue.push(node.children.values());
            }
          }
        }
        return {
          completedAt: serialized.completedAt,
          results: roots.map((r) => convertTestResultItem(r)).filter($Hg)
        };
      }
      TestResults2.to = to;
    })(TestResults || (TestResults = {}));
    (function(TestCoverage2) {
      function fromCoverageCount(count) {
        return { covered: count.covered, total: count.total };
      }
      function fromLocation(location2) {
        return "line" in location2 ? Position.from(location2) : Range2.from(location2);
      }
      function toLocation(location2) {
        if (!location2) {
          return void 0;
        }
        return "endLineNumber" in location2 ? Range2.to(location2) : Position.to(location2);
      }
      function to(serialized) {
        if (serialized.type === 1) {
          const branches = [];
          if (serialized.branches) {
            for (const branch of serialized.branches) {
              branches.push({
                executed: branch.count,
                location: toLocation(branch.location),
                label: branch.label
              });
            }
          }
          return new $nV(serialized.count, toLocation(serialized.location), serialized.branches?.map((b) => new $oV(b.count, toLocation(b.location), b.label)));
        } else {
          return new $pV(serialized.name, serialized.count, toLocation(serialized.location));
        }
      }
      TestCoverage2.to = to;
      function fromDetails(coverage) {
        if (typeof coverage.executed === "number" && coverage.executed < 0) {
          throw new Error(`Invalid coverage count ${coverage.executed}`);
        }
        if ("branches" in coverage) {
          return {
            count: coverage.executed,
            location: fromLocation(coverage.location),
            type: 1,
            branches: coverage.branches.length ? coverage.branches.map((b) => ({ count: b.executed, location: b.location && fromLocation(b.location), label: b.label })) : void 0
          };
        } else {
          return {
            type: 0,
            name: coverage.name,
            count: coverage.executed,
            location: fromLocation(coverage.location)
          };
        }
      }
      TestCoverage2.fromDetails = fromDetails;
      function fromFile(controllerId, id2, coverage) {
        $lV(coverage.statementCoverage);
        $lV(coverage.branchCoverage);
        $lV(coverage.declarationCoverage);
        return {
          id: id2,
          uri: coverage.uri,
          statement: fromCoverageCount(coverage.statementCoverage),
          branch: coverage.branchCoverage && fromCoverageCount(coverage.branchCoverage),
          declaration: coverage.declarationCoverage && fromCoverageCount(coverage.declarationCoverage),
          testIds: coverage instanceof $mV && coverage.includesTests.length ? coverage.includesTests.map((t) => $mQ.fromExtHostTestItem(t, controllerId).toString()) : void 0
        };
      }
      TestCoverage2.fromFile = fromFile;
    })(TestCoverage || (TestCoverage = {}));
    (function(CodeActionTriggerKind3) {
      function to(value) {
        switch (value) {
          case 1:
            return CodeActionTriggerKind.Invoke;
          case 2:
            return CodeActionTriggerKind.Automatic;
        }
      }
      CodeActionTriggerKind3.to = to;
    })(CodeActionTriggerKind2 || (CodeActionTriggerKind2 = {}));
    (function(TypeHierarchyItem2) {
      function to(item) {
        const result = new $qV(SymbolKind3.to(item.kind), item.name, item.detail || "", URI.revive(item.uri), Range2.to(item.range), Range2.to(item.selectionRange));
        result._sessionId = item._sessionId;
        result._itemId = item._itemId;
        return result;
      }
      TypeHierarchyItem2.to = to;
      function from(item, sessionId, itemId) {
        sessionId = sessionId ?? item._sessionId;
        itemId = itemId ?? item._itemId;
        if (sessionId === void 0 || itemId === void 0) {
          throw new Error("invalid item");
        }
        return {
          _sessionId: sessionId,
          _itemId: itemId,
          kind: SymbolKind3.from(item.kind),
          name: item.name,
          detail: item.detail ?? "",
          uri: item.uri,
          range: Range2.from(item.range),
          selectionRange: Range2.from(item.selectionRange),
          tags: item.tags?.map(SymbolTag3.from)
        };
      }
      TypeHierarchyItem2.from = from;
    })(TypeHierarchyItem || (TypeHierarchyItem = {}));
    (function(ViewBadge3) {
      function from(badge) {
        if (!badge) {
          return void 0;
        }
        return {
          value: badge.value,
          tooltip: badge.tooltip
        };
      }
      ViewBadge3.from = from;
    })(ViewBadge2 || (ViewBadge2 = {}));
    (function(DataTransferItem2) {
      function to(mime, item, resolveFileData) {
        const file = item.fileData;
        if (file) {
          return new $uU(new $vU(file.name, URI.revive(file.uri), file.id, $Qc(() => resolveFileData(file.id))));
        }
        if (mime === $YC.uriList && item.uriListData) {
          return new $tU(reviveUriList(item.uriListData));
        }
        return new $tU(item.asString);
      }
      DataTransferItem2.to = to;
      async function from(mime, item) {
        const stringValue = await item.asString();
        if (mime === $YC.uriList) {
          return {
            asString: stringValue,
            fileData: void 0,
            uriListData: serializeUriList(stringValue)
          };
        }
        const fileValue = item.asFile();
        return {
          asString: stringValue,
          fileData: fileValue ? {
            name: fileValue.name,
            uri: fileValue.uri,
            id: fileValue._itemId ?? fileValue.id
          } : void 0
        };
      }
      DataTransferItem2.from = from;
      function serializeUriList(stringValue) {
        return $nE.split(stringValue).map((part) => {
          if (part.startsWith("#")) {
            return part;
          }
          try {
            return URI.parse(part);
          } catch {
          }
          return part;
        });
      }
      function reviveUriList(parts) {
        return $nE.create(parts.map((part) => {
          return typeof part === "string" ? part : URI.revive(part);
        }));
      }
    })(DataTransferItem || (DataTransferItem = {}));
    (function(DataTransfer2) {
      function toDataTransfer(value, resolveFileData) {
        const init = value.items.map(([type2, item]) => {
          return [type2, DataTransferItem.to(type2, item, resolveFileData)];
        });
        return new $wU(init);
      }
      DataTransfer2.toDataTransfer = toDataTransfer;
      async function from(dataTransfer) {
        const newDTO = { items: [] };
        const promises15 = [];
        for (const [mime, value] of dataTransfer) {
          promises15.push((async () => {
            newDTO.items.push([mime, await DataTransferItem.from(mime, value)]);
          })());
        }
        await Promise.all(promises15);
        return newDTO;
      }
      DataTransfer2.from = from;
    })(DataTransfer || (DataTransfer = {}));
    (function(ChatFollowup2) {
      function from(followup, request2) {
        return {
          kind: "reply",
          agentId: followup.participant ?? request2?.agentId ?? "",
          subCommand: followup.command ?? request2?.command,
          message: followup.prompt,
          title: followup.label
        };
      }
      ChatFollowup2.from = from;
      function to(followup) {
        return {
          prompt: followup.message,
          label: followup.title,
          participant: followup.agentId,
          command: followup.subCommand
        };
      }
      ChatFollowup2.to = to;
    })(ChatFollowup || (ChatFollowup = {}));
    (function(LanguageModelChatMessageRole3) {
      function to(role) {
        switch (role) {
          case 0:
            return LanguageModelChatMessageRole.System;
          case 1:
            return LanguageModelChatMessageRole.User;
          case 2:
            return LanguageModelChatMessageRole.Assistant;
        }
      }
      LanguageModelChatMessageRole3.to = to;
      function from(role) {
        switch (role) {
          case LanguageModelChatMessageRole.System:
            return 0;
          case LanguageModelChatMessageRole.User:
            return 1;
          case LanguageModelChatMessageRole.Assistant:
            return 2;
        }
        return 1;
      }
      LanguageModelChatMessageRole3.from = from;
    })(LanguageModelChatMessageRole2 || (LanguageModelChatMessageRole2 = {}));
    (function(LanguageModelChatMessage2) {
      function to(message) {
        const content = message.content.map((c) => {
          if (c.type === "text") {
            return new $1V(c.value);
          } else if (c.type === "tool_result") {
            const content2 = c.value.map((part) => {
              if (part.type === "text") {
                return new $1V(part.value);
              } else {
                return new $2V(part.value);
              }
            });
            return new $XV(c.toolCallId, content2, c.isError);
          } else {
            return new $ZV(c.toolCallId, c.name, c.parameters);
          }
        });
        const role = LanguageModelChatMessageRole2.to(message.role);
        const result = new $YV(role, content, message.name);
        return result;
      }
      LanguageModelChatMessage2.to = to;
      function from(message) {
        const role = LanguageModelChatMessageRole2.from(message.role);
        const name = message.name;
        let messageContent = message.content;
        if (typeof messageContent === "string") {
          messageContent = [new $1V(messageContent)];
        }
        const content = messageContent.map((c) => {
          if (c instanceof $XV) {
            return {
              type: "tool_result",
              toolCallId: c.callId,
              value: $Mb(c.content.map((part) => {
                if (part instanceof $1V) {
                  return {
                    type: "text",
                    value: part.value
                  };
                } else if (part instanceof $2V) {
                  return {
                    type: "prompt_tsx",
                    value: part.value
                  };
                } else {
                  return void 0;
                }
              })),
              isError: c.isError
            };
          } else if (c instanceof $ZV) {
            return {
              type: "tool_use",
              toolCallId: c.callId,
              name: c.name,
              parameters: c.input
            };
          } else if (c instanceof $1V) {
            return {
              type: "text",
              value: c.value
            };
          } else {
            if (typeof c !== "string") {
              throw new Error("Unexpected chat message content type");
            }
            return {
              type: "text",
              value: c
            };
          }
        });
        return {
          role,
          name,
          content
        };
      }
      LanguageModelChatMessage2.from = from;
    })(LanguageModelChatMessage || (LanguageModelChatMessage = {}));
    (function(ChatResponseMarkdownPart2) {
      function from(part) {
        return {
          kind: "markdownContent",
          content: MarkdownString.from(part.value)
        };
      }
      ChatResponseMarkdownPart2.from = from;
      function to(part) {
        return new $DV(MarkdownString.to(part.content));
      }
      ChatResponseMarkdownPart2.to = to;
    })(ChatResponseMarkdownPart || (ChatResponseMarkdownPart = {}));
    (function(ChatResponseCodeblockUriPart2) {
      function from(part) {
        return {
          kind: "codeblockUri",
          uri: part.value
        };
      }
      ChatResponseCodeblockUriPart2.from = from;
      function to(part) {
        return new $OV(URI.revive(part.uri));
      }
      ChatResponseCodeblockUriPart2.to = to;
    })(ChatResponseCodeblockUriPart || (ChatResponseCodeblockUriPart = {}));
    (function(ChatResponseMarkdownWithVulnerabilitiesPart2) {
      function from(part) {
        return {
          kind: "markdownVuln",
          content: MarkdownString.from(part.value),
          vulnerabilities: part.vulnerabilities
        };
      }
      ChatResponseMarkdownWithVulnerabilitiesPart2.from = from;
      function to(part) {
        return new $EV(MarkdownString.to(part.content), part.vulnerabilities);
      }
      ChatResponseMarkdownWithVulnerabilitiesPart2.to = to;
    })(ChatResponseMarkdownWithVulnerabilitiesPart || (ChatResponseMarkdownWithVulnerabilitiesPart = {}));
    (function(ChatResponseDetectedParticipantPart2) {
      function from(part) {
        return {
          kind: "agentDetection",
          agentId: part.participant,
          command: part.command
        };
      }
      ChatResponseDetectedParticipantPart2.from = from;
      function to(part) {
        return new $FV(part.agentId, part.command);
      }
      ChatResponseDetectedParticipantPart2.to = to;
    })(ChatResponseDetectedParticipantPart || (ChatResponseDetectedParticipantPart = {}));
    (function(ChatResponseConfirmationPart2) {
      function from(part) {
        return {
          kind: "confirmation",
          title: part.title,
          message: part.message,
          data: part.data,
          buttons: part.buttons
        };
      }
      ChatResponseConfirmationPart2.from = from;
    })(ChatResponseConfirmationPart || (ChatResponseConfirmationPart = {}));
    (function(ChatResponseFilesPart2) {
      function from(part) {
        const { value, baseUri } = part;
        function convert(items, baseUri2) {
          return items.map((item) => {
            const myUri = URI.joinPath(baseUri2, item.name);
            return {
              label: item.name,
              uri: myUri,
              children: item.children && convert(item.children, myUri)
            };
          });
        }
        return {
          kind: "treeData",
          treeData: {
            label: $sh(baseUri),
            uri: baseUri,
            children: convert(value, baseUri)
          }
        };
      }
      ChatResponseFilesPart2.from = from;
      function to(part) {
        const treeData = $cu(part.treeData);
        function convert(items2) {
          return items2.map((item) => {
            return {
              name: item.label,
              children: item.children && convert(item.children)
            };
          });
        }
        const baseUri = treeData.uri;
        const items = treeData.children ? convert(treeData.children) : [];
        return new $HV(items, baseUri);
      }
      ChatResponseFilesPart2.to = to;
    })(ChatResponseFilesPart || (ChatResponseFilesPart = {}));
    (function(ChatResponseAnchorPart2) {
      function from(part) {
        const isUri = (thing) => URI.isUri(thing);
        const isSymbolInformation = (thing) => "name" in thing;
        return {
          kind: "inlineReference",
          name: part.title,
          inlineReference: isUri(part.value) ? part.value : isSymbolInformation(part.value) ? WorkspaceSymbol.from(part.value) : Location.from(part.value)
        };
      }
      ChatResponseAnchorPart2.from = from;
      function to(part) {
        const value = $cu(part);
        return new $IV(URI.isUri(value.inlineReference) ? value.inlineReference : "location" in value.inlineReference ? WorkspaceSymbol.to(value.inlineReference) : Location.to(value.inlineReference), part.name);
      }
      ChatResponseAnchorPart2.to = to;
    })(ChatResponseAnchorPart || (ChatResponseAnchorPart = {}));
    (function(ChatResponseProgressPart2) {
      function from(part) {
        return {
          kind: "progressMessage",
          content: MarkdownString.from(part.value)
        };
      }
      ChatResponseProgressPart2.from = from;
      function to(part) {
        return new $JV(part.content.value);
      }
      ChatResponseProgressPart2.to = to;
    })(ChatResponseProgressPart || (ChatResponseProgressPart = {}));
    (function(ChatResponseWarningPart2) {
      function from(part) {
        return {
          kind: "warning",
          content: MarkdownString.from(part.value)
        };
      }
      ChatResponseWarningPart2.from = from;
      function to(part) {
        return new $LV(part.content.value);
      }
      ChatResponseWarningPart2.to = to;
    })(ChatResponseWarningPart || (ChatResponseWarningPart = {}));
    (function(ChatResponseMovePart2) {
      function from(part) {
        return {
          kind: "move",
          uri: part.uri,
          range: Range2.from(part.range)
        };
      }
      ChatResponseMovePart2.from = from;
      function to(part) {
        return new $QV(URI.revive(part.uri), Range2.to(part.range));
      }
      ChatResponseMovePart2.to = to;
    })(ChatResponseMovePart || (ChatResponseMovePart = {}));
    (function(ChatTask2) {
      function from(part) {
        return {
          kind: "progressTask",
          content: MarkdownString.from(part.value)
        };
      }
      ChatTask2.from = from;
    })(ChatTask || (ChatTask = {}));
    (function(ChatTaskResult2) {
      function from(part) {
        return {
          kind: "progressTaskResult",
          content: typeof part === "string" ? MarkdownString.from(part) : void 0
        };
      }
      ChatTaskResult2.from = from;
    })(ChatTaskResult || (ChatTaskResult = {}));
    (function(ChatResponseCommandButtonPart2) {
      function from(part, commandsConverter, commandDisposables) {
        const command = commandsConverter.toInternal(part.value, commandDisposables) ?? { command: part.value.command, title: part.value.title };
        return {
          kind: "command",
          command
        };
      }
      ChatResponseCommandButtonPart2.from = from;
      function to(part, commandsConverter) {
        return new $MV(commandsConverter.fromInternal(part.command) ?? { command: part.command.id, title: part.command.title });
      }
      ChatResponseCommandButtonPart2.to = to;
    })(ChatResponseCommandButtonPart || (ChatResponseCommandButtonPart = {}));
    (function(ChatResponseTextEditPart2) {
      function from(part) {
        return {
          kind: "textEdit",
          uri: part.uri,
          edits: part.edits.map((e) => TextEdit.from(e)),
          done: part.isDone
        };
      }
      ChatResponseTextEditPart2.from = from;
      function to(part) {
        const result = new $RV(URI.revive(part.uri), part.edits.map((e) => TextEdit.to(e)));
        result.isDone = part.done;
        return result;
      }
      ChatResponseTextEditPart2.to = to;
    })(ChatResponseTextEditPart || (ChatResponseTextEditPart = {}));
    (function(ChatResponseReferencePart2) {
      function from(part) {
        const iconPath = ThemeIcon.isThemeIcon(part.iconPath) ? part.iconPath : URI.isUri(part.iconPath) ? { light: URI.revive(part.iconPath) } : part.iconPath && "light" in part.iconPath && "dark" in part.iconPath && URI.isUri(part.iconPath.light) && URI.isUri(part.iconPath.dark) ? { light: URI.revive(part.iconPath.light), dark: URI.revive(part.iconPath.dark) } : void 0;
        if (typeof part.value === "object" && "variableName" in part.value) {
          return {
            kind: "reference",
            reference: {
              variableName: part.value.variableName,
              value: URI.isUri(part.value.value) || !part.value.value ? part.value.value : Location.from(part.value.value)
            },
            iconPath,
            options: part.options
          };
        }
        return {
          kind: "reference",
          reference: URI.isUri(part.value) || typeof part.value === "string" ? part.value : Location.from(part.value),
          iconPath,
          options: part.options
        };
      }
      ChatResponseReferencePart2.from = from;
      function to(part) {
        const value = $cu(part);
        const mapValue = (value2) => URI.isUri(value2) ? value2 : Location.to(value2);
        return new $NV(typeof value.reference === "string" ? value.reference : "variableName" in value.reference ? {
          variableName: value.reference.variableName,
          value: value.reference.value && mapValue(value.reference.value)
        } : mapValue(value.reference));
      }
      ChatResponseReferencePart2.to = to;
    })(ChatResponseReferencePart || (ChatResponseReferencePart = {}));
    (function(ChatResponseCodeCitationPart2) {
      function from(part) {
        return {
          kind: "codeCitation",
          value: part.value,
          license: part.license,
          snippet: part.snippet
        };
      }
      ChatResponseCodeCitationPart2.from = from;
    })(ChatResponseCodeCitationPart || (ChatResponseCodeCitationPart = {}));
    (function(ChatResponsePart2) {
      function from(part, commandsConverter, commandDisposables) {
        if (part instanceof $DV) {
          return ChatResponseMarkdownPart.from(part);
        } else if (part instanceof $IV) {
          return ChatResponseAnchorPart.from(part);
        } else if (part instanceof $NV) {
          return ChatResponseReferencePart.from(part);
        } else if (part instanceof $JV) {
          return ChatResponseProgressPart.from(part);
        } else if (part instanceof $HV) {
          return ChatResponseFilesPart.from(part);
        } else if (part instanceof $MV) {
          return ChatResponseCommandButtonPart.from(part, commandsConverter, commandDisposables);
        } else if (part instanceof $RV) {
          return ChatResponseTextEditPart.from(part);
        } else if (part instanceof $EV) {
          return ChatResponseMarkdownWithVulnerabilitiesPart.from(part);
        } else if (part instanceof $OV) {
          return ChatResponseCodeblockUriPart.from(part);
        } else if (part instanceof $FV) {
          return ChatResponseDetectedParticipantPart.from(part);
        } else if (part instanceof $LV) {
          return ChatResponseWarningPart.from(part);
        } else if (part instanceof $GV) {
          return ChatResponseConfirmationPart.from(part);
        } else if (part instanceof $PV) {
          return ChatResponseCodeCitationPart.from(part);
        } else if (part instanceof $QV) {
          return ChatResponseMovePart.from(part);
        }
        return {
          kind: "markdownContent",
          content: MarkdownString.from("")
        };
      }
      ChatResponsePart2.from = from;
      function to(part, commandsConverter) {
        switch (part.kind) {
          case "reference":
            return ChatResponseReferencePart.to(part);
          case "markdownContent":
          case "inlineReference":
          case "progressMessage":
          case "treeData":
          case "command":
            return toContent(part, commandsConverter);
        }
        return void 0;
      }
      ChatResponsePart2.to = to;
      function toContent(part, commandsConverter) {
        switch (part.kind) {
          case "markdownContent":
            return ChatResponseMarkdownPart.to(part);
          case "inlineReference":
            return ChatResponseAnchorPart.to(part);
          case "progressMessage":
            return void 0;
          case "treeData":
            return ChatResponseFilesPart.to(part);
          case "command":
            return ChatResponseCommandButtonPart.to(part, commandsConverter);
        }
        return void 0;
      }
      ChatResponsePart2.toContent = toContent;
    })(ChatResponsePart || (ChatResponsePart = {}));
    (function(ChatAgentRequest2) {
      function to(request2, location2, model) {
        const toolReferences = request2.variables.variables.filter((v) => v.isTool);
        const variableReferences = request2.variables.variables.filter((v) => !v.isTool);
        return {
          prompt: request2.message,
          command: request2.command,
          attempt: request2.attempt ?? 0,
          enableCommandDetection: request2.enableCommandDetection ?? true,
          isParticipantDetected: request2.isParticipantDetected ?? false,
          references: variableReferences.map(ChatPromptReference.to),
          toolReferences: toolReferences.map(ChatLanguageModelToolReference.to),
          location: ChatLocation2.to(request2.location),
          acceptedConfirmationData: request2.acceptedConfirmationData,
          rejectedConfirmationData: request2.rejectedConfirmationData,
          location2,
          toolInvocationToken: Object.freeze({ sessionId: request2.sessionId }),
          model
        };
      }
      ChatAgentRequest2.to = to;
    })(ChatAgentRequest || (ChatAgentRequest = {}));
    (function(ChatRequestDraft2) {
      function to(request2) {
        return {
          prompt: request2.prompt,
          files: request2.files.map((uri) => URI.revive(uri))
        };
      }
      ChatRequestDraft2.to = to;
    })(ChatRequestDraft || (ChatRequestDraft = {}));
    (function(ChatLocation3) {
      function to(loc) {
        switch (loc) {
          case ChatAgentLocation.Notebook:
            return ChatLocation.Notebook;
          case ChatAgentLocation.Terminal:
            return ChatLocation.Terminal;
          case ChatAgentLocation.Panel:
            return ChatLocation.Panel;
          case ChatAgentLocation.Editor:
            return ChatLocation.Editor;
          case ChatAgentLocation.EditingSession:
            return ChatLocation.EditingSession;
        }
      }
      ChatLocation3.to = to;
      function from(loc) {
        switch (loc) {
          case ChatLocation.Notebook:
            return ChatAgentLocation.Notebook;
          case ChatLocation.Terminal:
            return ChatAgentLocation.Terminal;
          case ChatLocation.Panel:
            return ChatAgentLocation.Panel;
          case ChatLocation.Editor:
            return ChatAgentLocation.Editor;
          case ChatLocation.EditingSession:
            return ChatAgentLocation.EditingSession;
        }
      }
      ChatLocation3.from = from;
    })(ChatLocation2 || (ChatLocation2 = {}));
    (function(ChatPromptReference2) {
      function to(variable) {
        const value = variable.value;
        if (!value) {
          throw new Error("Invalid value reference");
        }
        return {
          id: variable.id,
          name: variable.name,
          range: variable.range && [variable.range.start, variable.range.endExclusive],
          value: $zc(value) ? URI.revive(value) : value && typeof value === "object" && "uri" in value && "range" in value && $zc(value.uri) ? Location.to($cu(value)) : variable.isImage ? new $WV(variable.mimeType ?? "image/png", () => Promise.resolve(new Uint8Array(Object.values(value)))) : value,
          modelDescription: variable.modelDescription
        };
      }
      ChatPromptReference2.to = to;
    })(ChatPromptReference || (ChatPromptReference = {}));
    (function(ChatLanguageModelToolReference2) {
      function to(variable) {
        const value = variable.value;
        if (value) {
          throw new Error("Invalid tool reference");
        }
        return {
          name: variable.id,
          range: variable.range && [variable.range.start, variable.range.endExclusive]
        };
      }
      ChatLanguageModelToolReference2.to = to;
    })(ChatLanguageModelToolReference || (ChatLanguageModelToolReference = {}));
    (function(ChatAgentCompletionItem2) {
      function from(item, commandsConverter, disposables) {
        return {
          id: item.id,
          label: item.label,
          fullName: item.fullName,
          icon: item.icon?.id,
          value: item.values[0].value,
          insertText: item.insertText,
          detail: item.detail,
          documentation: item.documentation,
          command: commandsConverter.toInternal(item.command, disposables)
        };
      }
      ChatAgentCompletionItem2.from = from;
    })(ChatAgentCompletionItem || (ChatAgentCompletionItem = {}));
    (function(ChatAgentResult2) {
      function to(result) {
        return {
          errorDetails: result.errorDetails,
          metadata: reviveMetadata(result.metadata),
          nextQuestion: result.nextQuestion
        };
      }
      ChatAgentResult2.to = to;
      function from(result) {
        return {
          errorDetails: result.errorDetails,
          metadata: result.metadata,
          nextQuestion: result.nextQuestion
        };
      }
      ChatAgentResult2.from = from;
      function reviveMetadata(metadata) {
        return $Nv(metadata, (value) => {
          if (value.$mid === 20) {
            return new $7V($Nv(value.content, reviveMetadata));
          } else if (value.$mid === 21) {
            return new $1V(value.value);
          } else if (value.$mid === 22) {
            return new $2V(value.value);
          }
          return void 0;
        });
      }
    })(ChatAgentResult || (ChatAgentResult = {}));
    (function(ChatAgentUserActionEvent2) {
      function to(result, event, commandsConverter) {
        if (event.action.kind === "vote") {
          return;
        }
        const ehResult = ChatAgentResult.to(result);
        if (event.action.kind === "command") {
          const command = event.action.commandButton.command;
          const commandButton = {
            command: commandsConverter.fromInternal(command) ?? { command: command.id, title: command.title }
          };
          const commandAction = { kind: "command", commandButton };
          return { action: commandAction, result: ehResult };
        } else if (event.action.kind === "followUp") {
          const followupAction = { kind: "followUp", followup: ChatFollowup.to(event.action.followup) };
          return { action: followupAction, result: ehResult };
        } else if (event.action.kind === "inlineChat") {
          return { action: { kind: "editor", accepted: event.action.action === "accepted" }, result: ehResult };
        } else if (event.action.kind === "chatEditingSessionAction") {
          const outcomes = /* @__PURE__ */ new Map([
            ["accepted", ChatEditingSessionActionOutcome.Accepted],
            ["rejected", ChatEditingSessionActionOutcome.Rejected],
            ["saved", ChatEditingSessionActionOutcome.Saved]
          ]);
          return {
            action: {
              kind: "chatEditingSessionAction",
              outcome: outcomes.get(event.action.outcome) ?? ChatEditingSessionActionOutcome.Rejected,
              uri: URI.revive(event.action.uri),
              hasRemainingEdits: event.action.hasRemainingEdits
            },
            result: ehResult
          };
        } else {
          return { action: event.action, result: ehResult };
        }
      }
      ChatAgentUserActionEvent2.to = to;
    })(ChatAgentUserActionEvent || (ChatAgentUserActionEvent = {}));
    (function(TerminalQuickFix2) {
      function from(quickFix, converter, disposables) {
        if ("terminalCommand" in quickFix) {
          return { terminalCommand: quickFix.terminalCommand, shouldExecute: quickFix.shouldExecute };
        }
        if ("uri" in quickFix) {
          return { uri: quickFix.uri };
        }
        return converter.toInternal(quickFix, disposables);
      }
      TerminalQuickFix2.from = from;
    })(TerminalQuickFix || (TerminalQuickFix = {}));
    (function(PartialAcceptInfo2) {
      function to(info) {
        return {
          kind: PartialAcceptTriggerKind3.to(info.kind)
        };
      }
      PartialAcceptInfo2.to = to;
    })(PartialAcceptInfo || (PartialAcceptInfo = {}));
    (function(PartialAcceptTriggerKind4) {
      function to(kind) {
        switch (kind) {
          case 0:
            return PartialAcceptTriggerKind.Word;
          case 1:
            return PartialAcceptTriggerKind.Line;
          case 2:
            return PartialAcceptTriggerKind.Suggest;
          default:
            return PartialAcceptTriggerKind.Unknown;
        }
      }
      PartialAcceptTriggerKind4.to = to;
    })(PartialAcceptTriggerKind3 || (PartialAcceptTriggerKind3 = {}));
    (function(DebugTreeItem2) {
      function from(item, id2) {
        return {
          id: id2,
          label: item.label,
          description: item.description,
          canEdit: item.canEdit,
          collapsibleState: item.collapsibleState || 0,
          contextValue: item.contextValue
        };
      }
      DebugTreeItem2.from = from;
    })(DebugTreeItem || (DebugTreeItem = {}));
    (function(LanguageModelToolDescription2) {
      function to(item) {
        return {
          // Note- the reason this is a unique 'name' is just to avoid confusion with the toolCallId
          name: item.id,
          description: item.modelDescription,
          inputSchema: item.inputSchema,
          tags: item.tags ?? []
        };
      }
      LanguageModelToolDescription2.to = to;
    })(LanguageModelToolDescription || (LanguageModelToolDescription = {}));
    (function(LanguageModelToolResult2) {
      function to(result) {
        return new $7V(result.content.map((item) => {
          if (item.kind === "text") {
            return new $1V(item.value);
          } else {
            return new $2V(item.value);
          }
        }));
      }
      LanguageModelToolResult2.to = to;
      function from(result) {
        return {
          content: result.content.map((item) => {
            if (item instanceof $1V) {
              return {
                kind: "text",
                value: item.value
              };
            } else if (item instanceof $2V) {
              return {
                kind: "promptTsx",
                value: item.value
              };
            } else {
              throw new Error("Unknown LanguageModelToolResult part type");
            }
          })
        };
      }
      LanguageModelToolResult2.from = from;
    })(LanguageModelToolResult || (LanguageModelToolResult = {}));
  }
});

// out-build/vs/workbench/services/extensions/common/proxyIdentifier.js
function $CS(identifier) {
  const result = new $BS(identifier);
  identifiers[result.nid] = result;
  return result;
}
var $BS, identifiers, $ES;
var init_proxyIdentifier = __esm({
  "out-build/vs/workbench/services/extensions/common/proxyIdentifier.js"() {
    "use strict";
    $BS = class _$BS {
      static {
        this.count = 0;
      }
      constructor(sid) {
        this._proxyIdentifierBrand = void 0;
        this.sid = sid;
        this.nid = ++_$BS.count;
      }
    };
    identifiers = [];
    $ES = class {
      constructor(value) {
        this.value = value;
      }
    };
  }
});

// out-build/vs/workbench/api/common/extHost.protocol.js
var TextEditorRevealType2, TabInputKind, TabModelOperationKind, WebviewEditorCapabilities, WebviewMessageArrayBufferViewType, CellOutputKind, NotebookEditorRevealType2, CandidatePortSource, $wT, ISuggestDataDtoField, ISuggestResultDtoField, ExtHostTestingResource, $xT, $yT;
var init_extHost_protocol = __esm({
  "out-build/vs/workbench/api/common/extHost.protocol.js"() {
    "use strict";
    init_proxyIdentifier();
    (function(TextEditorRevealType3) {
      TextEditorRevealType3[TextEditorRevealType3["Default"] = 0] = "Default";
      TextEditorRevealType3[TextEditorRevealType3["InCenter"] = 1] = "InCenter";
      TextEditorRevealType3[TextEditorRevealType3["InCenterIfOutsideViewport"] = 2] = "InCenterIfOutsideViewport";
      TextEditorRevealType3[TextEditorRevealType3["AtTop"] = 3] = "AtTop";
    })(TextEditorRevealType2 || (TextEditorRevealType2 = {}));
    (function(TabInputKind2) {
      TabInputKind2[TabInputKind2["UnknownInput"] = 0] = "UnknownInput";
      TabInputKind2[TabInputKind2["TextInput"] = 1] = "TextInput";
      TabInputKind2[TabInputKind2["TextDiffInput"] = 2] = "TextDiffInput";
      TabInputKind2[TabInputKind2["TextMergeInput"] = 3] = "TextMergeInput";
      TabInputKind2[TabInputKind2["NotebookInput"] = 4] = "NotebookInput";
      TabInputKind2[TabInputKind2["NotebookDiffInput"] = 5] = "NotebookDiffInput";
      TabInputKind2[TabInputKind2["CustomEditorInput"] = 6] = "CustomEditorInput";
      TabInputKind2[TabInputKind2["WebviewEditorInput"] = 7] = "WebviewEditorInput";
      TabInputKind2[TabInputKind2["TerminalEditorInput"] = 8] = "TerminalEditorInput";
      TabInputKind2[TabInputKind2["InteractiveEditorInput"] = 9] = "InteractiveEditorInput";
      TabInputKind2[TabInputKind2["ChatEditorInput"] = 10] = "ChatEditorInput";
      TabInputKind2[TabInputKind2["MultiDiffEditorInput"] = 11] = "MultiDiffEditorInput";
    })(TabInputKind || (TabInputKind = {}));
    (function(TabModelOperationKind2) {
      TabModelOperationKind2[TabModelOperationKind2["TAB_OPEN"] = 0] = "TAB_OPEN";
      TabModelOperationKind2[TabModelOperationKind2["TAB_CLOSE"] = 1] = "TAB_CLOSE";
      TabModelOperationKind2[TabModelOperationKind2["TAB_UPDATE"] = 2] = "TAB_UPDATE";
      TabModelOperationKind2[TabModelOperationKind2["TAB_MOVE"] = 3] = "TAB_MOVE";
    })(TabModelOperationKind || (TabModelOperationKind = {}));
    (function(WebviewEditorCapabilities2) {
      WebviewEditorCapabilities2[WebviewEditorCapabilities2["Editable"] = 0] = "Editable";
      WebviewEditorCapabilities2[WebviewEditorCapabilities2["SupportsHotExit"] = 1] = "SupportsHotExit";
    })(WebviewEditorCapabilities || (WebviewEditorCapabilities = {}));
    (function(WebviewMessageArrayBufferViewType2) {
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["Int8Array"] = 1] = "Int8Array";
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["Uint8Array"] = 2] = "Uint8Array";
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["Uint8ClampedArray"] = 3] = "Uint8ClampedArray";
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["Int16Array"] = 4] = "Int16Array";
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["Uint16Array"] = 5] = "Uint16Array";
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["Int32Array"] = 6] = "Int32Array";
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["Uint32Array"] = 7] = "Uint32Array";
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["Float32Array"] = 8] = "Float32Array";
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["Float64Array"] = 9] = "Float64Array";
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["BigInt64Array"] = 10] = "BigInt64Array";
      WebviewMessageArrayBufferViewType2[WebviewMessageArrayBufferViewType2["BigUint64Array"] = 11] = "BigUint64Array";
    })(WebviewMessageArrayBufferViewType || (WebviewMessageArrayBufferViewType = {}));
    (function(CellOutputKind2) {
      CellOutputKind2[CellOutputKind2["Text"] = 1] = "Text";
      CellOutputKind2[CellOutputKind2["Error"] = 2] = "Error";
      CellOutputKind2[CellOutputKind2["Rich"] = 3] = "Rich";
    })(CellOutputKind || (CellOutputKind = {}));
    (function(NotebookEditorRevealType3) {
      NotebookEditorRevealType3[NotebookEditorRevealType3["Default"] = 0] = "Default";
      NotebookEditorRevealType3[NotebookEditorRevealType3["InCenter"] = 1] = "InCenter";
      NotebookEditorRevealType3[NotebookEditorRevealType3["InCenterIfOutsideViewport"] = 2] = "InCenterIfOutsideViewport";
      NotebookEditorRevealType3[NotebookEditorRevealType3["AtTop"] = 3] = "AtTop";
    })(NotebookEditorRevealType2 || (NotebookEditorRevealType2 = {}));
    (function(CandidatePortSource2) {
      CandidatePortSource2[CandidatePortSource2["None"] = 0] = "None";
      CandidatePortSource2[CandidatePortSource2["Process"] = 1] = "Process";
      CandidatePortSource2[CandidatePortSource2["Output"] = 2] = "Output";
      CandidatePortSource2[CandidatePortSource2["Hybrid"] = 3] = "Hybrid";
    })(CandidatePortSource || (CandidatePortSource = {}));
    $wT = class _$wT {
      static {
        this.a = 0;
      }
      static mixin(object) {
        object._id = _$wT.a++;
        return object;
      }
    };
    (function(ISuggestDataDtoField2) {
      ISuggestDataDtoField2["label"] = "a";
      ISuggestDataDtoField2["kind"] = "b";
      ISuggestDataDtoField2["detail"] = "c";
      ISuggestDataDtoField2["documentation"] = "d";
      ISuggestDataDtoField2["sortText"] = "e";
      ISuggestDataDtoField2["filterText"] = "f";
      ISuggestDataDtoField2["preselect"] = "g";
      ISuggestDataDtoField2["insertText"] = "h";
      ISuggestDataDtoField2["insertTextRules"] = "i";
      ISuggestDataDtoField2["range"] = "j";
      ISuggestDataDtoField2["commitCharacters"] = "k";
      ISuggestDataDtoField2["additionalTextEdits"] = "l";
      ISuggestDataDtoField2["kindModifier"] = "m";
      ISuggestDataDtoField2["commandIdent"] = "n";
      ISuggestDataDtoField2["commandId"] = "o";
      ISuggestDataDtoField2["commandArguments"] = "p";
    })(ISuggestDataDtoField || (ISuggestDataDtoField = {}));
    (function(ISuggestResultDtoField2) {
      ISuggestResultDtoField2["defaultRanges"] = "a";
      ISuggestResultDtoField2["completions"] = "b";
      ISuggestResultDtoField2["isIncomplete"] = "c";
      ISuggestResultDtoField2["duration"] = "d";
    })(ISuggestResultDtoField || (ISuggestResultDtoField = {}));
    (function(ExtHostTestingResource2) {
      ExtHostTestingResource2[ExtHostTestingResource2["Workspace"] = 0] = "Workspace";
      ExtHostTestingResource2[ExtHostTestingResource2["TextDocument"] = 1] = "TextDocument";
    })(ExtHostTestingResource || (ExtHostTestingResource = {}));
    $xT = {
      MainThreadAuthentication: $CS("MainThreadAuthentication"),
      MainThreadBulkEdits: $CS("MainThreadBulkEdits"),
      MainThreadLanguageModels: $CS("MainThreadLanguageModels"),
      MainThreadEmbeddings: $CS("MainThreadEmbeddings"),
      MainThreadChatAgents2: $CS("MainThreadChatAgents2"),
      MainThreadCodeMapper: $CS("MainThreadCodeMapper"),
      MainThreadChatVariables: $CS("MainThreadChatVariables"),
      MainThreadLanguageModelTools: $CS("MainThreadChatSkills"),
      MainThreadClipboard: $CS("MainThreadClipboard"),
      MainThreadCommands: $CS("MainThreadCommands"),
      MainThreadComments: $CS("MainThreadComments"),
      MainThreadConfiguration: $CS("MainThreadConfiguration"),
      MainThreadConsole: $CS("MainThreadConsole"),
      MainThreadDebugService: $CS("MainThreadDebugService"),
      MainThreadDecorations: $CS("MainThreadDecorations"),
      MainThreadDiagnostics: $CS("MainThreadDiagnostics"),
      MainThreadDialogs: $CS("MainThreadDiaglogs"),
      MainThreadDocuments: $CS("MainThreadDocuments"),
      MainThreadDocumentContentProviders: $CS("MainThreadDocumentContentProviders"),
      MainThreadTextEditors: $CS("MainThreadTextEditors"),
      MainThreadEditorInsets: $CS("MainThreadEditorInsets"),
      MainThreadEditorTabs: $CS("MainThreadEditorTabs"),
      MainThreadErrors: $CS("MainThreadErrors"),
      MainThreadTreeViews: $CS("MainThreadTreeViews"),
      MainThreadDownloadService: $CS("MainThreadDownloadService"),
      MainThreadLanguageFeatures: $CS("MainThreadLanguageFeatures"),
      MainThreadLanguages: $CS("MainThreadLanguages"),
      MainThreadLogger: $CS("MainThreadLogger"),
      MainThreadMessageService: $CS("MainThreadMessageService"),
      MainThreadOutputService: $CS("MainThreadOutputService"),
      MainThreadProgress: $CS("MainThreadProgress"),
      MainThreadQuickDiff: $CS("MainThreadQuickDiff"),
      MainThreadQuickOpen: $CS("MainThreadQuickOpen"),
      MainThreadStatusBar: $CS("MainThreadStatusBar"),
      MainThreadSecretState: $CS("MainThreadSecretState"),
      MainThreadStorage: $CS("MainThreadStorage"),
      MainThreadSpeech: $CS("MainThreadSpeechProvider"),
      MainThreadTelemetry: $CS("MainThreadTelemetry"),
      MainThreadTerminalService: $CS("MainThreadTerminalService"),
      MainThreadTerminalShellIntegration: $CS("MainThreadTerminalShellIntegration"),
      MainThreadWebviews: $CS("MainThreadWebviews"),
      MainThreadWebviewPanels: $CS("MainThreadWebviewPanels"),
      MainThreadWebviewViews: $CS("MainThreadWebviewViews"),
      MainThreadCustomEditors: $CS("MainThreadCustomEditors"),
      MainThreadUrls: $CS("MainThreadUrls"),
      MainThreadUriOpeners: $CS("MainThreadUriOpeners"),
      MainThreadProfileContentHandlers: $CS("MainThreadProfileContentHandlers"),
      MainThreadWorkspace: $CS("MainThreadWorkspace"),
      MainThreadFileSystem: $CS("MainThreadFileSystem"),
      MainThreadFileSystemEventService: $CS("MainThreadFileSystemEventService"),
      MainThreadExtensionService: $CS("MainThreadExtensionService"),
      MainThreadSCM: $CS("MainThreadSCM"),
      MainThreadSearch: $CS("MainThreadSearch"),
      MainThreadShare: $CS("MainThreadShare"),
      MainThreadTask: $CS("MainThreadTask"),
      MainThreadWindow: $CS("MainThreadWindow"),
      MainThreadLabelService: $CS("MainThreadLabelService"),
      MainThreadNotebook: $CS("MainThreadNotebook"),
      MainThreadNotebookDocuments: $CS("MainThreadNotebookDocumentsShape"),
      MainThreadNotebookEditors: $CS("MainThreadNotebookEditorsShape"),
      MainThreadNotebookKernels: $CS("MainThreadNotebookKernels"),
      MainThreadNotebookRenderers: $CS("MainThreadNotebookRenderers"),
      MainThreadInteractive: $CS("MainThreadInteractive"),
      MainThreadTheming: $CS("MainThreadTheming"),
      MainThreadTunnelService: $CS("MainThreadTunnelService"),
      MainThreadManagedSockets: $CS("MainThreadManagedSockets"),
      MainThreadTimeline: $CS("MainThreadTimeline"),
      MainThreadTesting: $CS("MainThreadTesting"),
      MainThreadLocalization: $CS("MainThreadLocalizationShape"),
      MainThreadAiRelatedInformation: $CS("MainThreadAiRelatedInformation"),
      MainThreadAiEmbeddingVector: $CS("MainThreadAiEmbeddingVector")
    };
    $yT = {
      ExtHostCodeMapper: $CS("ExtHostCodeMapper"),
      ExtHostCommands: $CS("ExtHostCommands"),
      ExtHostConfiguration: $CS("ExtHostConfiguration"),
      ExtHostDiagnostics: $CS("ExtHostDiagnostics"),
      ExtHostDebugService: $CS("ExtHostDebugService"),
      ExtHostDecorations: $CS("ExtHostDecorations"),
      ExtHostDocumentsAndEditors: $CS("ExtHostDocumentsAndEditors"),
      ExtHostDocuments: $CS("ExtHostDocuments"),
      ExtHostDocumentContentProviders: $CS("ExtHostDocumentContentProviders"),
      ExtHostDocumentSaveParticipant: $CS("ExtHostDocumentSaveParticipant"),
      ExtHostEditors: $CS("ExtHostEditors"),
      ExtHostTreeViews: $CS("ExtHostTreeViews"),
      ExtHostFileSystem: $CS("ExtHostFileSystem"),
      ExtHostFileSystemInfo: $CS("ExtHostFileSystemInfo"),
      ExtHostFileSystemEventService: $CS("ExtHostFileSystemEventService"),
      ExtHostLanguages: $CS("ExtHostLanguages"),
      ExtHostLanguageFeatures: $CS("ExtHostLanguageFeatures"),
      ExtHostQuickOpen: $CS("ExtHostQuickOpen"),
      ExtHostQuickDiff: $CS("ExtHostQuickDiff"),
      ExtHostStatusBar: $CS("ExtHostStatusBar"),
      ExtHostShare: $CS("ExtHostShare"),
      ExtHostExtensionService: $CS("ExtHostExtensionService"),
      ExtHostLogLevelServiceShape: $CS("ExtHostLogLevelServiceShape"),
      ExtHostTerminalService: $CS("ExtHostTerminalService"),
      ExtHostTerminalShellIntegration: $CS("ExtHostTerminalShellIntegration"),
      ExtHostSCM: $CS("ExtHostSCM"),
      ExtHostSearch: $CS("ExtHostSearch"),
      ExtHostTask: $CS("ExtHostTask"),
      ExtHostWorkspace: $CS("ExtHostWorkspace"),
      ExtHostWindow: $CS("ExtHostWindow"),
      ExtHostWebviews: $CS("ExtHostWebviews"),
      ExtHostWebviewPanels: $CS("ExtHostWebviewPanels"),
      ExtHostCustomEditors: $CS("ExtHostCustomEditors"),
      ExtHostWebviewViews: $CS("ExtHostWebviewViews"),
      ExtHostEditorInsets: $CS("ExtHostEditorInsets"),
      ExtHostEditorTabs: $CS("ExtHostEditorTabs"),
      ExtHostProgress: $CS("ExtHostProgress"),
      ExtHostComments: $CS("ExtHostComments"),
      ExtHostSecretState: $CS("ExtHostSecretState"),
      ExtHostStorage: $CS("ExtHostStorage"),
      ExtHostUrls: $CS("ExtHostUrls"),
      ExtHostUriOpeners: $CS("ExtHostUriOpeners"),
      ExtHostProfileContentHandlers: $CS("ExtHostProfileContentHandlers"),
      ExtHostOutputService: $CS("ExtHostOutputService"),
      ExtHostLabelService: $CS("ExtHostLabelService"),
      ExtHostNotebook: $CS("ExtHostNotebook"),
      ExtHostNotebookDocuments: $CS("ExtHostNotebookDocuments"),
      ExtHostNotebookEditors: $CS("ExtHostNotebookEditors"),
      ExtHostNotebookKernels: $CS("ExtHostNotebookKernels"),
      ExtHostNotebookRenderers: $CS("ExtHostNotebookRenderers"),
      ExtHostNotebookDocumentSaveParticipant: $CS("ExtHostNotebookDocumentSaveParticipant"),
      ExtHostInteractive: $CS("ExtHostInteractive"),
      ExtHostChatAgents2: $CS("ExtHostChatAgents"),
      ExtHostChatVariables: $CS("ExtHostChatVariables"),
      ExtHostLanguageModelTools: $CS("ExtHostChatSkills"),
      ExtHostChatProvider: $CS("ExtHostChatProvider"),
      ExtHostSpeech: $CS("ExtHostSpeech"),
      ExtHostEmbeddings: $CS("ExtHostEmbeddings"),
      ExtHostAiRelatedInformation: $CS("ExtHostAiRelatedInformation"),
      ExtHostAiEmbeddingVector: $CS("ExtHostAiEmbeddingVector"),
      ExtHostTheming: $CS("ExtHostTheming"),
      ExtHostTunnelService: $CS("ExtHostTunnelService"),
      ExtHostManagedSockets: $CS("ExtHostManagedSockets"),
      ExtHostAuthentication: $CS("ExtHostAuthentication"),
      ExtHostTimeline: $CS("ExtHostTimeline"),
      ExtHostTesting: $CS("ExtHostTesting"),
      ExtHostTelemetry: $CS("ExtHostTelemetry"),
      ExtHostLocalization: $CS("ExtHostLocalization")
    };
  }
});

// out-build/vs/workbench/api/common/extHostRpcService.js
var $gW;
var init_extHostRpcService = __esm({
  "out-build/vs/workbench/api/common/extHostRpcService.js"() {
    "use strict";
    init_instantiation();
    $gW = $Qk("IExtHostRpcService");
  }
});

// out-build/vs/workbench/api/common/extHostTestItem.js
var testItemPropAccessor, strictEqualComparator2, propComparators, evSetProps, makePropDescriptors, $tW, $uW;
var init_extHostTestItem = __esm({
  "out-build/vs/workbench/api/common/extHostTestItem.js"() {
    "use strict";
    init_uri();
    init_range();
    init_testId();
    init_testItemCollection();
    init_testTypes();
    init_extHostTestingPrivateApi();
    init_extHostTypeConverters();
    testItemPropAccessor = (api, defaultValue, equals, toUpdate) => {
      let value = defaultValue;
      return {
        enumerable: true,
        configurable: false,
        get() {
          return value;
        },
        set(newValue) {
          if (!equals(value, newValue)) {
            const oldValue = value;
            value = newValue;
            api.listener?.(toUpdate(newValue, oldValue));
          }
        }
      };
    };
    strictEqualComparator2 = (a, b) => a === b;
    propComparators = {
      range: (a, b) => {
        if (a === b) {
          return true;
        }
        if (!a || !b) {
          return false;
        }
        return a.isEqual(b);
      },
      label: strictEqualComparator2,
      description: strictEqualComparator2,
      sortText: strictEqualComparator2,
      busy: strictEqualComparator2,
      error: strictEqualComparator2,
      canResolveChildren: strictEqualComparator2,
      tags: (a, b) => {
        if (a.length !== b.length) {
          return false;
        }
        if (a.some((t1) => !b.find((t2) => t1.id === t2.id))) {
          return false;
        }
        return true;
      }
    };
    evSetProps = (fn) => (v) => ({ op: 4, update: fn(v) });
    makePropDescriptors = (api, label) => ({
      range: (() => {
        let value;
        const updateProps = evSetProps((r) => ({ range: $9C.lift(Range2.from(r)) }));
        return {
          enumerable: true,
          configurable: false,
          get() {
            return value;
          },
          set(newValue) {
            api.listener?.({
              op: 6
              /* TestItemEventOp.DocumentSynced */
            });
            if (!propComparators.range(value, newValue)) {
              value = newValue;
              api.listener?.(updateProps(newValue));
            }
          }
        };
      })(),
      label: testItemPropAccessor(api, label, propComparators.label, evSetProps((label2) => ({ label: label2 }))),
      description: testItemPropAccessor(api, void 0, propComparators.description, evSetProps((description) => ({ description }))),
      sortText: testItemPropAccessor(api, void 0, propComparators.sortText, evSetProps((sortText) => ({ sortText }))),
      canResolveChildren: testItemPropAccessor(api, false, propComparators.canResolveChildren, (state) => ({
        op: 2,
        state
      })),
      busy: testItemPropAccessor(api, false, propComparators.busy, evSetProps((busy) => ({ busy }))),
      error: testItemPropAccessor(api, void 0, propComparators.error, evSetProps((error) => ({ error: MarkdownString.fromStrict(error) || null }))),
      tags: testItemPropAccessor(api, [], propComparators.tags, (current, previous) => ({
        op: 1,
        new: current.map(TestTag.from),
        old: previous.map(TestTag.from)
      }))
    });
    $tW = class _$tW {
      /**
       * Note that data is deprecated and here for back-compat only
       */
      constructor(controllerId, id2, label, uri) {
        if (id2.includes(
          "\0"
          /* TestIdPathParts.Delimiter */
        )) {
          throw new Error(`Test IDs may not include the ${JSON.stringify(id2)} symbol`);
        }
        const api = $bW(this, controllerId);
        Object.defineProperties(this, {
          id: {
            value: id2,
            enumerable: true,
            writable: false
          },
          uri: {
            value: uri,
            enumerable: true,
            writable: false
          },
          parent: {
            enumerable: false,
            get() {
              return api.parent instanceof $uW ? void 0 : api.parent;
            }
          },
          children: {
            value: $aW(api, $cW, _$tW),
            enumerable: true,
            writable: false
          },
          ...makePropDescriptors(api, label)
        });
      }
    };
    $uW = class extends $tW {
      constructor(controllerId, label) {
        super(controllerId, controllerId, label, void 0);
        this._isRoot = true;
      }
    };
  }
});

// out-build/vs/workbench/api/common/extHostInitDataService.js
var $wW;
var init_extHostInitDataService = __esm({
  "out-build/vs/workbench/api/common/extHostInitDataService.js"() {
    "use strict";
    init_instantiation();
    $wW = $Qk("IExtHostInitDataService");
  }
});

// out-build/vs/workbench/services/extensions/common/extensionHostProtocol.js
var UIKind, ExtensionHostExitCode, MessageType, NativeLogMarkers;
var init_extensionHostProtocol = __esm({
  "out-build/vs/workbench/services/extensions/common/extensionHostProtocol.js"() {
    "use strict";
    init_buffer();
    (function(UIKind2) {
      UIKind2[UIKind2["Desktop"] = 1] = "Desktop";
      UIKind2[UIKind2["Web"] = 2] = "Web";
    })(UIKind || (UIKind = {}));
    (function(ExtensionHostExitCode2) {
      ExtensionHostExitCode2[ExtensionHostExitCode2["VersionMismatch"] = 55] = "VersionMismatch";
      ExtensionHostExitCode2[ExtensionHostExitCode2["UnexpectedError"] = 81] = "UnexpectedError";
    })(ExtensionHostExitCode || (ExtensionHostExitCode = {}));
    (function(MessageType2) {
      MessageType2[MessageType2["Initialized"] = 0] = "Initialized";
      MessageType2[MessageType2["Ready"] = 1] = "Ready";
      MessageType2[MessageType2["Terminate"] = 2] = "Terminate";
    })(MessageType || (MessageType = {}));
    (function(NativeLogMarkers2) {
      NativeLogMarkers2["Start"] = "START_NATIVE_LOG";
      NativeLogMarkers2["End"] = "END_NATIVE_LOG";
    })(NativeLogMarkers || (NativeLogMarkers = {}));
  }
});

// out-build/vs/workbench/api/common/extHostTelemetry.js
function $zW(firstSessionDate) {
  const installAge = Date.now() - new Date(firstSessionDate).getTime();
  return isNaN(installAge) ? false : installAge < 1e3 * 60 * 60 * 24;
}
var $xW, $yW, $AW;
var init_extHostTelemetry = __esm({
  "out-build/vs/workbench/api/common/extHostTelemetry.js"() {
    "use strict";
    init_instantiation();
    init_event();
    init_log();
    init_extHostInitDataService();
    init_extensionHostProtocol();
    init_remoteHosts();
    init_telemetryUtils();
    init_objects();
    init_uri();
    init_lifecycle();
    init_nls2();
    $xW = class $xW2 extends $3c {
      constructor(s, t) {
        super();
        this.s = s;
        this.t = t;
        this.a = this.B(new $ze());
        this.onDidChangeTelemetryEnabled = this.a.event;
        this.b = this.B(new $ze());
        this.onDidChangeTelemetryConfiguration = this.b.event;
        this.c = { usage: true, error: true };
        this.f = 0;
        this.g = false;
        this.j = false;
        this.r = /* @__PURE__ */ new Map();
        this.m = URI.revive(this.s.environment.extensionTelemetryLogResource);
        this.j = this.s.environment.isExtensionTelemetryLoggingOnly;
        this.n = t.createLogger(this.m, { id: $gw, name: localize(2767, null, this.j ? " (Not Sent)" : ""), hidden: true });
        this.B(this.n);
        this.B(t.onDidChangeLogLevel((arg) => {
          if ($yn(arg)) {
            this.u();
          }
        }));
        this.n.info("Below are logs for extension telemetry events sent to the telemetry output channel API once the log level is set to trace.");
        this.n.info("===========================================================");
      }
      u() {
        this.t.setVisibility(this.m, this.g && this.t.getLogLevel() === LogLevel.Trace);
      }
      getTelemetryConfiguration() {
        return this.f === 3;
      }
      getTelemetryDetails() {
        return {
          isCrashEnabled: this.f >= 1,
          isErrorsEnabled: this.c.error ? this.f >= 2 : false,
          isUsageEnabled: this.c.usage ? this.f >= 3 : false
        };
      }
      instantiateLogger(extension, sender, options2) {
        const telemetryDetails = this.getTelemetryDetails();
        const logger = new $yW(sender, options2, extension, this.n, this.j, this.getBuiltInCommonProperties(extension), { isUsageEnabled: telemetryDetails.isUsageEnabled, isErrorsEnabled: telemetryDetails.isErrorsEnabled });
        const loggers = this.r.get(extension.identifier.value) ?? [];
        this.r.set(extension.identifier.value, [...loggers, logger]);
        return logger.apiTelemetryLogger;
      }
      $initializeTelemetryLevel(level, supportsTelemetry, productConfig) {
        this.f = level;
        this.g = supportsTelemetry;
        this.c = productConfig ?? { usage: true, error: true };
        this.u();
      }
      getBuiltInCommonProperties(extension) {
        const commonProperties = /* @__PURE__ */ Object.create(null);
        commonProperties["common.extname"] = `${extension.publisher}.${extension.name}`;
        commonProperties["common.extversion"] = extension.version;
        commonProperties["common.vscodemachineid"] = this.s.telemetryInfo.machineId;
        commonProperties["common.vscodesessionid"] = this.s.telemetryInfo.sessionId;
        commonProperties["common.sqmid"] = this.s.telemetryInfo.sqmId;
        commonProperties["common.devDeviceId"] = this.s.telemetryInfo.devDeviceId;
        commonProperties["common.vscodeversion"] = this.s.version;
        commonProperties["common.isnewappinstall"] = $zW(this.s.telemetryInfo.firstSessionDate);
        commonProperties["common.product"] = this.s.environment.appHost;
        switch (this.s.uiKind) {
          case UIKind.Web:
            commonProperties["common.uikind"] = "web";
            break;
          case UIKind.Desktop:
            commonProperties["common.uikind"] = "desktop";
            break;
          default:
            commonProperties["common.uikind"] = "unknown";
        }
        commonProperties["common.remotename"] = $9v($mw(this.s.remote.authority));
        return commonProperties;
      }
      $onDidChangeTelemetryLevel(level) {
        this.h = this.getTelemetryConfiguration();
        this.f = level;
        const telemetryDetails = this.getTelemetryDetails();
        this.r.forEach((loggers, key) => {
          const newLoggers = loggers.filter((l) => !l.isDisposed);
          if (newLoggers.length === 0) {
            this.r.delete(key);
          } else {
            this.r.set(key, newLoggers);
          }
        });
        this.r.forEach((loggers) => {
          for (const logger of loggers) {
            logger.updateTelemetryEnablements(telemetryDetails.isUsageEnabled, telemetryDetails.isErrorsEnabled);
          }
        });
        if (this.h !== this.getTelemetryConfiguration()) {
          this.a.fire(this.getTelemetryConfiguration());
        }
        this.b.fire(this.getTelemetryDetails());
        this.u();
      }
      onExtensionError(extension, error) {
        const loggers = this.r.get(extension.value);
        const nonDisposedLoggers = loggers?.filter((l) => !l.isDisposed);
        if (!nonDisposedLoggers) {
          this.r.delete(extension.value);
          return false;
        }
        let errorEmitted = false;
        for (const logger of nonDisposedLoggers) {
          if (logger.ignoreUnhandledExtHostErrors) {
            continue;
          }
          logger.logError(error);
          errorEmitted = true;
        }
        return errorEmitted;
      }
    };
    $xW = __decorate([
      __param(0, $wW),
      __param(1, $xn)
    ], $xW);
    $yW = class {
      static validateSender(sender) {
        if (typeof sender !== "object") {
          throw new TypeError("TelemetrySender argument is invalid");
        }
        if (typeof sender.sendEventData !== "function") {
          throw new TypeError("TelemetrySender.sendEventData must be a function");
        }
        if (typeof sender.sendErrorData !== "function") {
          throw new TypeError("TelemetrySender.sendErrorData must be a function");
        }
        if (typeof sender.flush !== "undefined" && typeof sender.flush !== "function") {
          throw new TypeError("TelemetrySender.flush must be a function or undefined");
        }
      }
      constructor(sender, options2, g, h, i, j, telemetryEnablements) {
        this.g = g;
        this.h = h;
        this.i = i;
        this.j = j;
        this.a = new $ze();
        this.ignoreUnhandledExtHostErrors = options2?.ignoreUnhandledErrors ?? false;
        this.b = options2?.ignoreBuiltInCommonProperties ?? false;
        this.c = options2?.additionalCommonProperties;
        this.f = sender;
        this.d = { isUsageEnabled: telemetryEnablements.isUsageEnabled, isErrorsEnabled: telemetryEnablements.isErrorsEnabled };
      }
      updateTelemetryEnablements(isUsageEnabled, isErrorsEnabled) {
        if (this.e) {
          this.d = { isUsageEnabled, isErrorsEnabled };
          this.a.fire(this.e);
        }
      }
      mixInCommonPropsAndCleanData(data) {
        let updatedData = "properties" in data ? data.properties ?? {} : data;
        updatedData = $pw(updatedData, []);
        if (this.c) {
          updatedData = $Ov(updatedData, this.c);
        }
        if (!this.b) {
          updatedData = $Ov(updatedData, this.j);
        }
        if ("properties" in data) {
          data.properties = updatedData;
        } else {
          data = updatedData;
        }
        return data;
      }
      k(eventName, data) {
        if (!this.f) {
          return;
        }
        if (this.g.publisher === "vscode") {
          eventName = this.g.name + "/" + eventName;
        } else {
          eventName = this.g.identifier.value + "/" + eventName;
        }
        data = this.mixInCommonPropsAndCleanData(data || {});
        if (!this.i) {
          this.f?.sendEventData(eventName, data);
        }
        this.h.trace(eventName, data);
      }
      logUsage(eventName, data) {
        if (!this.d.isUsageEnabled) {
          return;
        }
        this.k(eventName, data);
      }
      logError(eventNameOrException, data) {
        if (!this.d.isErrorsEnabled || !this.f) {
          return;
        }
        if (typeof eventNameOrException === "string") {
          this.k(eventNameOrException, data);
        } else {
          const errorData = {
            name: eventNameOrException.name,
            message: eventNameOrException.message,
            stack: eventNameOrException.stack,
            cause: eventNameOrException.cause
          };
          const cleanedErrorData = $pw(errorData, []);
          const cleanedError = new Error(cleanedErrorData.message, {
            cause: cleanedErrorData.cause
          });
          cleanedError.stack = cleanedErrorData.stack;
          cleanedError.name = cleanedErrorData.name;
          data = this.mixInCommonPropsAndCleanData(data || {});
          if (!this.i) {
            this.f.sendErrorData(cleanedError, data);
          }
          this.h.trace("exception", data);
        }
      }
      get apiTelemetryLogger() {
        if (!this.e) {
          const that = this;
          const obj = {
            logUsage: that.logUsage.bind(that),
            get isUsageEnabled() {
              return that.d.isUsageEnabled;
            },
            get isErrorsEnabled() {
              return that.d.isErrorsEnabled;
            },
            logError: that.logError.bind(that),
            dispose: that.dispose.bind(that),
            onDidChangeEnableStates: that.a.event.bind(that)
          };
          this.e = Object.freeze(obj);
        }
        return this.e;
      }
      get isDisposed() {
        return !this.f;
      }
      dispose() {
        if (this.f?.flush) {
          let tempSender = this.f;
          this.f = void 0;
          Promise.resolve(tempSender.flush()).then(tempSender = void 0);
          this.e = void 0;
        } else {
          this.f = void 0;
        }
      }
    };
    $AW = $Qk("IExtHostTelemetry");
  }
});

// out-build/vs/workbench/api/common/extHostCommands.js
var $BW, $CW, $DW, $EW, $FW;
var init_extHostCommands = __esm({
  "out-build/vs/workbench/api/common/extHostCommands.js"() {
    "use strict";
    init_types();
    init_extHostTypes();
    init_extHostTypeConverters();
    init_objects();
    init_extHost_protocol();
    init_arrays();
    init_log();
    init_marshalling();
    init_range();
    init_position();
    init_uri();
    init_lifecycle();
    init_instantiation();
    init_extHostRpcService();
    init_extHostTestItem();
    init_buffer();
    init_proxyIdentifier();
    init_errorMessage();
    init_stopwatch();
    init_telemetryUtils();
    init_extHostTelemetry();
    init_uuid();
    $BW = class $BW2 {
      #proxy;
      #telemetry;
      #extHostTelemetry;
      constructor(extHostRpc, logService, extHostTelemetry) {
        this.b = /* @__PURE__ */ new Map();
        this.c = /* @__PURE__ */ new Map();
        this.#proxy = extHostRpc.getProxy($xT.MainThreadCommands);
        this.d = logService;
        this.#extHostTelemetry = extHostTelemetry;
        this.#telemetry = extHostRpc.getProxy($xT.MainThreadTelemetry);
        this.converter = new $DW(this, (id2) => {
          const candidate = this.c.get(id2);
          return candidate?.result === $FW.Void ? candidate : void 0;
        }, logService);
        this.f = [
          {
            processArgument(a) {
              return $cu(a);
            }
          },
          {
            processArgument(arg) {
              return $Nv(arg, function(obj) {
                if ($9C.isIRange(obj)) {
                  return Range2.to(obj);
                }
                if ($8C.isIPosition(obj)) {
                  return Position.to(obj);
                }
                if ($9C.isIRange(obj.range) && URI.isUri(obj.uri)) {
                  return location.to(obj);
                }
                if (obj instanceof $Ci) {
                  return obj.buffer.buffer;
                }
                if (!Array.isArray(obj)) {
                  return obj;
                }
              });
            }
          }
        ];
      }
      registerArgumentProcessor(processor) {
        this.f.push(processor);
      }
      registerApiCommand(apiCommand) {
        const registration = this.registerCommand(false, apiCommand.id, async (...apiArgs) => {
          const internalArgs = apiCommand.args.map((arg, i) => {
            if (!arg.validate(apiArgs[i])) {
              throw new Error(`Invalid argument '${arg.name}' when running '${apiCommand.id}', received: ${typeof apiArgs[i] === "object" ? JSON.stringify(apiArgs[i], null, "	") : apiArgs[i]} `);
            }
            return arg.convert(apiArgs[i]);
          });
          const internalResult = await this.executeCommand(apiCommand.internalId, ...internalArgs);
          return apiCommand.result.convert(internalResult, apiArgs, this.converter);
        }, void 0, {
          description: apiCommand.description,
          args: apiCommand.args,
          returns: apiCommand.result.description
        });
        this.c.set(apiCommand.id, apiCommand);
        return new $zT(() => {
          registration.dispose();
          this.c.delete(apiCommand.id);
        });
      }
      registerCommand(global2, id2, callback, thisArg, metadata, extension) {
        this.d.trace("ExtHostCommands#registerCommand", id2);
        if (!id2.trim().length) {
          throw new Error("invalid id");
        }
        if (this.b.has(id2)) {
          throw new Error(`command '${id2}' already exists`);
        }
        this.b.set(id2, { callback, thisArg, metadata, extension });
        if (global2) {
          this.#proxy.$registerCommand(id2);
        }
        return new $zT(() => {
          if (this.b.delete(id2)) {
            if (global2) {
              this.#proxy.$unregisterCommand(id2);
            }
          }
        });
      }
      executeCommand(id2, ...args) {
        this.d.trace("ExtHostCommands#executeCommand", id2);
        return this.g(id2, args, true);
      }
      async g(id2, args, retry) {
        if (this.b.has(id2)) {
          this.#proxy.$fireCommandActivationEvent(id2);
          return this.h(id2, args, false);
        } else {
          let hasBuffers = false;
          const toArgs = $Nv(args, function(value) {
            if (value instanceof $AT) {
              return Position.from(value);
            } else if (value instanceof $BT) {
              return Range2.from(value);
            } else if (value instanceof $NT) {
              return location.from(value);
            } else if ($6U.isNotebookRange(value)) {
              return NotebookRange.from(value);
            } else if (value instanceof ArrayBuffer) {
              hasBuffers = true;
              return $Ci.wrap(new Uint8Array(value));
            } else if (value instanceof Uint8Array) {
              hasBuffers = true;
              return $Ci.wrap(value);
            } else if (value instanceof $Ci) {
              hasBuffers = true;
              return value;
            }
            if (!Array.isArray(value)) {
              return value;
            }
          });
          try {
            const result = await this.#proxy.$executeCommand(id2, hasBuffers ? new $ES(toArgs) : toArgs, retry);
            return $cu(result);
          } catch (e) {
            if (e instanceof Error && e.message === "$executeCommand:retry") {
              return this.g(id2, args, false);
            } else {
              throw e;
            }
          }
        }
      }
      async h(id2, args, annotateError) {
        const command = this.b.get(id2);
        if (!command) {
          throw new Error("Unknown command");
        }
        const { callback, thisArg, metadata } = command;
        if (metadata?.args) {
          for (let i = 0; i < metadata.args.length; i++) {
            try {
              $Qg(args[i], metadata.args[i].constraint);
            } catch (err) {
              throw new Error(`Running the contributed command: '${id2}' failed. Illegal argument '${metadata.args[i].name}' - ${metadata.args[i].description}`);
            }
          }
        }
        const stopWatch = $te.create();
        try {
          return await callback.apply(thisArg, args);
        } catch (err) {
          if (id2 === this.converter.delegatingCommandId) {
            const actual = this.converter.getActualCommand(...args);
            if (actual) {
              id2 = actual.command;
            }
          }
          this.d.error(err, id2, command.extension?.identifier);
          if (!annotateError) {
            throw err;
          }
          if (command.extension?.identifier) {
            const reported = this.#extHostTelemetry.onExtensionError(command.extension.identifier, err);
            this.d.trace("forwarded error to extension?", reported, command.extension?.identifier);
          }
          throw new class CommandError extends Error {
            constructor() {
              super($1m(err));
              this.id = id2;
              this.source = command.extension?.displayName ?? command.extension?.name;
            }
          }();
        } finally {
          this.j(command, id2, stopWatch.elapsed());
        }
      }
      j(command, id2, duration) {
        if (!command.extension) {
          return;
        }
        this.#telemetry.$publicLog2("Extension:ActionExecuted", {
          extensionId: command.extension.identifier.value,
          id: new $bw(id2),
          duration
        });
      }
      $executeContributedCommand(id2, ...args) {
        this.d.trace("ExtHostCommands#$executeContributedCommand", id2);
        const cmdHandler = this.b.get(id2);
        if (!cmdHandler) {
          return Promise.reject(new Error(`Contributed command '${id2}' does not exist.`));
        } else {
          args = args.map((arg) => this.f.reduce((r, p) => p.processArgument(r, cmdHandler.extension?.identifier), arg));
          return this.h(id2, args, true);
        }
      }
      getCommands(filterUnderscoreCommands = false) {
        this.d.trace("ExtHostCommands#getCommands", filterUnderscoreCommands);
        return this.#proxy.$getCommands().then((result) => {
          if (filterUnderscoreCommands) {
            result = result.filter((command) => command[0] !== "_");
          }
          return result;
        });
      }
      $getContributedCommandMetadata() {
        const result = /* @__PURE__ */ Object.create(null);
        for (const [id2, command] of this.b) {
          const { metadata } = command;
          if (metadata) {
            result[id2] = metadata;
          }
        }
        return Promise.resolve(result);
      }
    };
    $BW = __decorate([
      __param(0, $gW),
      __param(1, $wn),
      __param(2, $AW)
    ], $BW);
    $CW = $Qk("IExtHostCommands");
    $DW = class {
      // --- conversion between internal and api commands
      constructor(d, f, g) {
        this.d = d;
        this.f = f;
        this.g = g;
        this.delegatingCommandId = `__vsc${$ps()}`;
        this.b = /* @__PURE__ */ new Map();
        this.c = 0;
        this.d.registerCommand(true, this.delegatingCommandId, this.h, this);
      }
      toInternal(command, disposables) {
        if (!command) {
          return void 0;
        }
        const result = {
          $ident: void 0,
          id: command.command,
          title: command.title,
          tooltip: command.tooltip
        };
        if (!command.command) {
          return result;
        }
        const apiCommand = this.f(command.command);
        if (apiCommand) {
          result.id = apiCommand.internalId;
          result.arguments = apiCommand.args.map((arg, i) => arg.convert(command.arguments && command.arguments[i]));
        } else if ($Qb(command.arguments)) {
          const id2 = `${command.command} /${++this.c}`;
          this.b.set(id2, command);
          disposables.add($1c(() => {
            this.b.delete(id2);
            this.g.trace("CommandsConverter#DISPOSE", id2);
          }));
          result.$ident = id2;
          result.id = this.delegatingCommandId;
          result.arguments = [id2];
          this.g.trace("CommandsConverter#CREATE", command.command, id2);
        }
        return result;
      }
      fromInternal(command) {
        if (typeof command.$ident === "string") {
          return this.b.get(command.$ident);
        } else {
          return {
            command: command.id,
            title: command.title,
            arguments: command.arguments
          };
        }
      }
      getActualCommand(...args) {
        return this.b.get(args[0]);
      }
      h(...args) {
        const actualCmd = this.getActualCommand(...args);
        this.g.trace("CommandsConverter#EXECUTE", args[0], actualCmd ? actualCmd.command : "MISSING");
        if (!actualCmd) {
          return Promise.reject(`Actual command not found, wanted to execute ${args[0]}`);
        }
        return this.d.executeCommand(actualCmd.command, ...actualCmd.arguments || []);
      }
    };
    $EW = class _$EW {
      static {
        this.Uri = new _$EW("uri", "Uri of a text document", (v) => URI.isUri(v), (v) => v);
      }
      static {
        this.Position = new _$EW("position", "A position in a text document", (v) => $AT.isPosition(v), Position.from);
      }
      static {
        this.Range = new _$EW("range", "A range in a text document", (v) => $BT.isRange(v), Range2.from);
      }
      static {
        this.Selection = new _$EW("selection", "A selection in a text document", (v) => $CT.isSelection(v), Selection.from);
      }
      static {
        this.Number = new _$EW("number", "", (v) => typeof v === "number", (v) => v);
      }
      static {
        this.String = new _$EW("string", "", (v) => typeof v === "string", (v) => v);
      }
      static {
        this.StringArray = _$EW.Arr(_$EW.String);
      }
      static Arr(element) {
        return new _$EW(`${element.name}_array`, `Array of ${element.name}, ${element.description}`, (v) => Array.isArray(v) && v.every((e) => element.validate(e)), (v) => v.map((e) => element.convert(e)));
      }
      static {
        this.CallHierarchyItem = new _$EW("item", "A call hierarchy item", (v) => v instanceof $ZT, CallHierarchyItem.from);
      }
      static {
        this.TypeHierarchyItem = new _$EW("item", "A type hierarchy item", (v) => v instanceof $qV, TypeHierarchyItem.from);
      }
      static {
        this.TestItem = new _$EW("testItem", "A VS Code TestItem", (v) => v instanceof $tW, TestItem.from);
      }
      static {
        this.TestProfile = new _$EW("testProfile", "A VS Code test profile", (v) => v instanceof $fV, TestRunProfile.from);
      }
      constructor(name, description, validate, convert) {
        this.name = name;
        this.description = description;
        this.validate = validate;
        this.convert = convert;
      }
      optional() {
        return new _$EW(this.name, `(optional) ${this.description}`, (value) => value === void 0 || value === null || this.validate(value), (value) => value === void 0 ? void 0 : value === null ? null : this.convert(value));
      }
      with(name, description) {
        return new _$EW(name ?? this.name, description ?? this.description, this.validate, this.convert);
      }
    };
    $FW = class _$FW {
      static {
        this.Void = new _$FW("no result", (v) => v);
      }
      constructor(description, convert) {
        this.description = description;
        this.convert = convert;
      }
    };
  }
});

// out-build/vs/workbench/api/node/extHostCLIServer.js
import * as http from "http";
import * as fs11 from "fs";
var $HW, $IW;
var init_extHostCLIServer = __esm({
  "out-build/vs/workbench/api/node/extHostCLIServer.js"() {
    "use strict";
    init_ipc_net2();
    init_extHostCommands();
    init_uri();
    init_log();
    init_workspace();
    $HW = class {
      constructor(b, c, f) {
        this.b = b;
        this.c = c;
        this.f = f;
        this.a = http.createServer((req, res) => this.h(req, res));
        this.g().catch((err) => {
          c.error(err);
          return "";
        });
      }
      get ipcHandlePath() {
        return this.f;
      }
      async g() {
        try {
          this.a.listen(this.ipcHandlePath);
          this.a.on("error", (err) => this.c.error(err));
        } catch (err) {
          this.c.error("Could not start open from terminal server.");
        }
        return this.f;
      }
      h(req, res) {
        const sendResponse = (statusCode, returnObj) => {
          res.writeHead(statusCode, { "content-type": "application/json" });
          res.end(JSON.stringify(returnObj || null), (err) => err && this.c.error(err));
        };
        const chunks = [];
        req.setEncoding("utf8");
        req.on("data", (d) => chunks.push(d));
        req.on("end", async () => {
          try {
            const data = JSON.parse(chunks.join(""));
            let returnObj;
            switch (data.type) {
              case "open":
                returnObj = await this.i(data);
                break;
              case "openExternal":
                returnObj = await this.j(data);
                break;
              case "status":
                returnObj = await this.l(data);
                break;
              case "extensionManagement":
                returnObj = await this.k(data);
                break;
              default:
                sendResponse(404, `Unknown message type: ${data.type}`);
                break;
            }
            sendResponse(200, returnObj);
          } catch (e) {
            const message = e instanceof Error ? e.message : JSON.stringify(e);
            sendResponse(500, message);
            this.c.error("Error while processing pipe request", e);
          }
        });
      }
      async i(data) {
        const { fileURIs, folderURIs, forceNewWindow, diffMode, mergeMode, addMode, forceReuseWindow, gotoLineMode, waitMarkerFilePath, remoteAuthority } = data;
        const urisToOpen = [];
        if (Array.isArray(folderURIs)) {
          for (const s of folderURIs) {
            try {
              urisToOpen.push({ folderUri: URI.parse(s) });
            } catch (e) {
            }
          }
        }
        if (Array.isArray(fileURIs)) {
          for (const s of fileURIs) {
            try {
              if ($jl(s)) {
                urisToOpen.push({ workspaceUri: URI.parse(s) });
              } else {
                urisToOpen.push({ fileUri: URI.parse(s) });
              }
            } catch (e) {
            }
          }
        }
        const waitMarkerFileURI = waitMarkerFilePath ? URI.file(waitMarkerFilePath) : void 0;
        const preferNewWindow = !forceReuseWindow && !waitMarkerFileURI && !addMode;
        const windowOpenArgs = { forceNewWindow, diffMode, mergeMode, addMode, gotoLineMode, forceReuseWindow, preferNewWindow, waitMarkerFileURI, remoteAuthority };
        this.b.executeCommand("_remoteCLI.windowOpen", urisToOpen, windowOpenArgs);
      }
      async j(data) {
        for (const uriString of data.uris) {
          const uri = URI.parse(uriString);
          const urioOpen = uri.scheme === "file" ? uri : uriString;
          await this.b.executeCommand("_remoteCLI.openExternal", urioOpen);
        }
      }
      async k(data) {
        const toExtOrVSIX = (inputs) => inputs?.map((input) => /\.vsix$/i.test(input) ? URI.parse(input) : input);
        const commandArgs = {
          list: data.list,
          install: toExtOrVSIX(data.install),
          uninstall: toExtOrVSIX(data.uninstall),
          force: data.force
        };
        return await this.b.executeCommand("_remoteCLI.manageExtensions", commandArgs);
      }
      async l(data) {
        return await this.b.executeCommand("_remoteCLI.getSystemStatus");
      }
      dispose() {
        this.a.close();
        if (this.f && process.platform !== "win32" && fs11.existsSync(this.f)) {
          fs11.unlinkSync(this.f);
        }
      }
    };
    $IW = class $IW2 extends $HW {
      constructor(commands, logService) {
        super(commands, logService, $xu());
      }
    };
    $IW = __decorate([
      __param(0, $CW),
      __param(1, $wn)
    ], $IW);
  }
});

// out-build/vs/platform/terminal/common/terminalEnvironment.js
function $rY(cwd3) {
  if (cwd3.match(/^['"].*['"]$/)) {
    cwd3 = cwd3.substring(1, cwd3.length - 1);
  }
  if (OS === 1 && cwd3 && cwd3[1] === ":") {
    return cwd3[0].toUpperCase() + cwd3.substring(1);
  }
  return cwd3;
}
function $sY(slc) {
  return !slc.strictEnv;
}
var init_terminalEnvironment2 = __esm({
  "out-build/vs/platform/terminal/common/terminalEnvironment.js"() {
    "use strict";
    init_platform();
  }
});

// out-build/vs/workbench/contrib/terminal/common/terminalEnvironment.js
function $uY(parent, other) {
  if (!other) {
    return;
  }
  if ($l) {
    for (const configKey in other) {
      let actualKey = configKey;
      for (const envKey in parent) {
        if (configKey.toLowerCase() === envKey.toLowerCase()) {
          actualKey = envKey;
          break;
        }
      }
      const value = other[configKey];
      if (value !== void 0) {
        _mergeEnvironmentValue(parent, actualKey, value);
      }
    }
  } else {
    Object.keys(other).forEach((key) => {
      const value = other[key];
      if (value !== void 0) {
        _mergeEnvironmentValue(parent, key, value);
      }
    });
  }
}
function _mergeEnvironmentValue(env2, key, value) {
  if (typeof value === "string") {
    env2[key] = value;
  } else {
    delete env2[key];
  }
}
function $vY(env2, version, locale, detectLocale) {
  env2["TERM_PROGRAM"] = "vscode";
  if (version) {
    env2["TERM_PROGRAM_VERSION"] = version;
  }
  if ($wY(env2, detectLocale)) {
    env2["LANG"] = $xY(locale);
  }
  env2["COLORTERM"] = "truecolor";
}
function mergeNonNullKeys(env2, other) {
  if (!other) {
    return;
  }
  for (const key of Object.keys(other)) {
    const value = other[key];
    if (value !== void 0 && value !== null) {
      env2[key] = value;
    }
  }
}
async function resolveConfigurationVariables(variableResolver, env2) {
  await Promise.all(Object.entries(env2).map(async ([key, value]) => {
    if (typeof value === "string") {
      try {
        env2[key] = await variableResolver(value);
      } catch (e) {
        env2[key] = value;
      }
    }
  }));
  return env2;
}
function $wY(env2, detectLocale) {
  if (detectLocale === "on") {
    return true;
  }
  if (detectLocale === "auto") {
    const lang = env2["LANG"];
    return !lang || lang.search(/\.UTF\-8$/) === -1 && lang.search(/\.utf8$/) === -1 && lang.search(/\.euc.+/) === -1;
  }
  return false;
}
function $xY(locale) {
  const parts = locale ? locale.split("-") : [];
  const n = parts.length;
  if (n === 0) {
    return "en_US.UTF-8";
  }
  if (n === 1) {
    const languageVariants = {
      af: "ZA",
      am: "ET",
      be: "BY",
      bg: "BG",
      ca: "ES",
      cs: "CZ",
      da: "DK",
      // de: 'AT',
      // de: 'CH',
      de: "DE",
      el: "GR",
      // en: 'AU',
      // en: 'CA',
      // en: 'GB',
      // en: 'IE',
      // en: 'NZ',
      en: "US",
      es: "ES",
      et: "EE",
      eu: "ES",
      fi: "FI",
      // fr: 'BE',
      // fr: 'CA',
      // fr: 'CH',
      fr: "FR",
      he: "IL",
      hr: "HR",
      hu: "HU",
      hy: "AM",
      is: "IS",
      // it: 'CH',
      it: "IT",
      ja: "JP",
      kk: "KZ",
      ko: "KR",
      lt: "LT",
      // nl: 'BE',
      nl: "NL",
      no: "NO",
      pl: "PL",
      pt: "BR",
      // pt: 'PT',
      ro: "RO",
      ru: "RU",
      sk: "SK",
      sl: "SI",
      sr: "YU",
      sv: "SE",
      tr: "TR",
      uk: "UA",
      zh: "CN"
    };
    if (parts[0] in languageVariants) {
      parts.push(languageVariants[parts[0]]);
    }
  } else {
    parts[1] = parts[1].toUpperCase();
  }
  return parts.join("_") + ".UTF-8";
}
async function $yY(shell, userHome, variableResolver, root, customCwd, logService) {
  if (shell.cwd) {
    const unresolved = typeof shell.cwd === "object" ? shell.cwd.fsPath : shell.cwd;
    const resolved = await _resolveCwd(unresolved, variableResolver);
    return $rY(resolved || unresolved);
  }
  let cwd3;
  if (!shell.ignoreConfigurationCwd && customCwd) {
    if (variableResolver) {
      customCwd = await _resolveCwd(customCwd, variableResolver, logService);
    }
    if (customCwd) {
      if ($mc(customCwd)) {
        cwd3 = customCwd;
      } else if (root) {
        cwd3 = $nc(root.fsPath, customCwd);
      }
    }
  }
  if (!cwd3) {
    cwd3 = root ? root.fsPath : userHome || "";
  }
  return $rY(cwd3);
}
async function _resolveCwd(cwd3, variableResolver, logService) {
  if (variableResolver) {
    try {
      return await variableResolver(cwd3);
    } catch (e) {
      logService?.error("Could not resolve terminal cwd", e);
      return void 0;
    }
  }
  return cwd3;
}
function $zY(lastActiveWorkspace, env2, configurationResolverService) {
  if (!configurationResolverService) {
    return void 0;
  }
  return (str) => configurationResolverService.resolveWithEnvironment(env2, lastActiveWorkspace, str);
}
async function $AY(shellLaunchConfig, envFromConfig, variableResolver, version, detectLocale, baseEnv) {
  const env2 = {};
  if (shellLaunchConfig.strictEnv) {
    mergeNonNullKeys(env2, shellLaunchConfig.env);
  } else {
    mergeNonNullKeys(env2, baseEnv);
    const allowedEnvFromConfig = { ...envFromConfig };
    if (variableResolver) {
      if (allowedEnvFromConfig) {
        await resolveConfigurationVariables(variableResolver, allowedEnvFromConfig);
      }
      if (shellLaunchConfig.env) {
        await resolveConfigurationVariables(variableResolver, shellLaunchConfig.env);
      }
    }
    if ($m) {
      if (env2["VSCODE_NODE_OPTIONS"]) {
        env2["NODE_OPTIONS"] = env2["VSCODE_NODE_OPTIONS"];
        delete env2["VSCODE_NODE_OPTIONS"];
      }
      if (env2["VSCODE_NODE_REPL_EXTERNAL_MODULE"]) {
        env2["NODE_REPL_EXTERNAL_MODULE"] = env2["VSCODE_NODE_REPL_EXTERNAL_MODULE"];
        delete env2["VSCODE_NODE_REPL_EXTERNAL_MODULE"];
      }
    }
    $Ex(env2, "VSCODE_IPC_HOOK_CLI");
    $uY(env2, allowedEnvFromConfig);
    $uY(env2, shellLaunchConfig.env);
    $vY(env2, version, $z, detectLocale);
  }
  return env2;
}
var init_terminalEnvironment3 = __esm({
  "out-build/vs/workbench/contrib/terminal/common/terminalEnvironment.js"() {
    "use strict";
    init_path();
    init_uri();
    init_processes();
    init_platform();
    init_terminalEnvironment2();
    init_types();
  }
});

// out-build/vs/base/common/labels.js
function $1t(path7, isWindowsOS = $l) {
  if ($5g(path7, isWindowsOS)) {
    return path7.charAt(0).toUpperCase() + path7.slice(1);
  }
  return path7;
}
var Type;
var init_labels = __esm({
  "out-build/vs/base/common/labels.js"() {
    "use strict";
    init_extpath();
    init_path();
    init_platform();
    init_resources();
    init_strings();
    (function(Type2) {
      Type2[Type2["TEXT"] = 0] = "TEXT";
      Type2[Type2["VARIABLE"] = 1] = "VARIABLE";
      Type2[Type2["SEPARATOR"] = 2] = "SEPARATOR";
    })(Type || (Type = {}));
  }
});

// out-build/vs/workbench/services/configurationResolver/common/configurationResolver.js
var $nY, VariableKind, $oY;
var init_configurationResolver = __esm({
  "out-build/vs/workbench/services/configurationResolver/common/configurationResolver.js"() {
    "use strict";
    init_instantiation();
    init_errors();
    $nY = $Qk("configurationResolverService");
    (function(VariableKind2) {
      VariableKind2["Unknown"] = "unknown";
      VariableKind2["Env"] = "env";
      VariableKind2["Config"] = "config";
      VariableKind2["Command"] = "command";
      VariableKind2["Input"] = "input";
      VariableKind2["ExtensionInstallFolder"] = "extensionInstallFolder";
      VariableKind2["WorkspaceFolder"] = "workspaceFolder";
      VariableKind2["Cwd"] = "cwd";
      VariableKind2["WorkspaceFolderBasename"] = "workspaceFolderBasename";
      VariableKind2["UserHome"] = "userHome";
      VariableKind2["LineNumber"] = "lineNumber";
      VariableKind2["SelectedText"] = "selectedText";
      VariableKind2["File"] = "file";
      VariableKind2["FileWorkspaceFolder"] = "fileWorkspaceFolder";
      VariableKind2["FileWorkspaceFolderBasename"] = "fileWorkspaceFolderBasename";
      VariableKind2["RelativeFile"] = "relativeFile";
      VariableKind2["RelativeFileDirname"] = "relativeFileDirname";
      VariableKind2["FileDirname"] = "fileDirname";
      VariableKind2["FileExtname"] = "fileExtname";
      VariableKind2["FileBasename"] = "fileBasename";
      VariableKind2["FileBasenameNoExtension"] = "fileBasenameNoExtension";
      VariableKind2["FileDirnameBasename"] = "fileDirnameBasename";
      VariableKind2["ExecPath"] = "execPath";
      VariableKind2["ExecInstallFolder"] = "execInstallFolder";
      VariableKind2["PathSeparator"] = "pathSeparator";
      VariableKind2["PathSeparatorAlias"] = "/";
    })(VariableKind || (VariableKind = {}));
    $oY = class extends $ub {
      constructor(variable, message) {
        super(message);
        this.variable = variable;
      }
    };
  }
});

// out-build/vs/workbench/services/configurationResolver/common/variableResolver.js
var $DY;
var init_variableResolver = __esm({
  "out-build/vs/workbench/services/configurationResolver/common/variableResolver.js"() {
    "use strict";
    init_path();
    init_process();
    init_types();
    init_objects();
    init_platform();
    init_labels();
    init_nls2();
    init_configurationResolver();
    init_strings();
    $DY = class _$DY {
      static {
        this.VARIABLE_LHS = "${";
      }
      static {
        this.VARIABLE_REGEXP = /\$\{(.*?)\}/g;
      }
      constructor(_context, _labelService, _userHomePromise, _envVariablesPromise) {
        this.h = /* @__PURE__ */ new Map();
        this.a = _context;
        this.b = _labelService;
        this.g = _userHomePromise;
        if (_envVariablesPromise) {
          this.c = _envVariablesPromise.then((envVariables) => {
            return this.i(envVariables);
          });
        }
      }
      i(envVariables) {
        if ($l) {
          const ev = /* @__PURE__ */ Object.create(null);
          Object.keys(envVariables).forEach((key) => {
            ev[key.toLowerCase()] = envVariables[key];
          });
          return ev;
        }
        return envVariables;
      }
      resolveWithEnvironment(environment, root, value) {
        return this.l({ env: this.i(environment), userHome: void 0 }, root ? root.uri : void 0, value);
      }
      async resolveAsync(root, value) {
        const environment = {
          env: await this.c,
          userHome: await this.g
        };
        return this.l(environment, root ? root.uri : void 0, value);
      }
      async j(workspaceFolder, config, commandValueMapping, resolvedVariables) {
        const result = $Lv(config);
        if ($l && result.windows) {
          Object.keys(result.windows).forEach((key) => result[key] = result.windows[key]);
        } else if ($m && result.osx) {
          Object.keys(result.osx).forEach((key) => result[key] = result.osx[key]);
        } else if ($n && result.linux) {
          Object.keys(result.linux).forEach((key) => result[key] = result.linux[key]);
        }
        delete result.windows;
        delete result.osx;
        delete result.linux;
        const environmentPromises = {
          env: await this.c,
          userHome: await this.g
        };
        return this.l(environmentPromises, workspaceFolder ? workspaceFolder.uri : void 0, result, commandValueMapping, resolvedVariables);
      }
      async resolveAnyAsync(workspaceFolder, config, commandValueMapping) {
        return this.j(workspaceFolder, config, commandValueMapping);
      }
      async resolveAnyMap(workspaceFolder, config, commandValueMapping) {
        const resolvedVariables = /* @__PURE__ */ new Map();
        const newConfig = await this.j(workspaceFolder, config, commandValueMapping, resolvedVariables);
        return { newConfig, resolvedVariables };
      }
      resolveWithInteractionReplace(folder, config, section, variables) {
        throw new Error("resolveWithInteractionReplace not implemented.");
      }
      resolveWithInteraction(folder, config, section, variables) {
        throw new Error("resolveWithInteraction not implemented.");
      }
      contributeVariable(variable, resolution) {
        if (this.h.has(variable)) {
          throw new Error("Variable " + variable + " is contributed twice.");
        } else {
          this.h.set(variable, resolution);
        }
      }
      async l(environment, folderUri, value, commandValueMapping, resolvedVariables) {
        if ($zg(value)) {
          return this.m(environment, folderUri, value, commandValueMapping, resolvedVariables);
        } else if (Array.isArray(value)) {
          return Promise.all(value.map((s) => this.l(environment, folderUri, s, commandValueMapping, resolvedVariables)));
        } else if ($Bg(value)) {
          const result = /* @__PURE__ */ Object.create(null);
          const replaced = await Promise.all(Object.keys(value).map(async (key) => {
            const replaced2 = await this.m(environment, folderUri, key, commandValueMapping, resolvedVariables);
            return [replaced2, await this.l(environment, folderUri, value[key], commandValueMapping, resolvedVariables)];
          }));
          for (const [key, value2] of replaced) {
            result[key] = value2;
          }
          return result;
        }
        return value;
      }
      m(environment, folderUri, value, commandValueMapping, resolvedVariables) {
        return $Sf(value, _$DY.VARIABLE_REGEXP, async (match, variable) => {
          if (variable.includes(_$DY.VARIABLE_LHS)) {
            return match;
          }
          let resolvedValue = await this.o(environment, match, variable, folderUri, commandValueMapping);
          resolvedVariables?.set(variable, resolvedValue);
          if (resolvedValue !== match && $zg(resolvedValue) && resolvedValue.match(_$DY.VARIABLE_REGEXP)) {
            resolvedValue = await this.m(environment, folderUri, resolvedValue, commandValueMapping, resolvedVariables);
          }
          return resolvedValue;
        });
      }
      n(displayUri) {
        return this.b ? this.b.getUriLabel(displayUri, { noPrefix: true }) : displayUri.fsPath;
      }
      async o(environment, match, variable, folderUri, commandValueMapping) {
        let argument;
        const parts = variable.split(":");
        if (parts.length > 1) {
          variable = parts[0];
          argument = parts[1];
        }
        const getFilePath = (variableKind) => {
          const filePath = this.a.getFilePath();
          if (filePath) {
            return $1t(filePath);
          }
          throw new $oY(variableKind, localize(12635, null, match));
        };
        const getFolderPathForFile = (variableKind) => {
          const filePath = getFilePath(variableKind);
          if (this.a.getWorkspaceFolderPathForFile) {
            const folderPath = this.a.getWorkspaceFolderPathForFile();
            if (folderPath) {
              return $1t(folderPath);
            }
          }
          throw new $oY(variableKind, localize(12636, null, match, $rc(filePath)));
        };
        const getFolderUri = (variableKind) => {
          if (argument) {
            const folder = this.a.getFolderUri(argument);
            if (folder) {
              return folder;
            }
            throw new $oY(variableKind, localize(12637, null, match, argument));
          }
          if (folderUri) {
            return folderUri;
          }
          if (this.a.getWorkspaceFolderCount() > 1) {
            throw new $oY(variableKind, localize(12638, null, match));
          }
          throw new $oY(variableKind, localize(12639, null, match));
        };
        switch (variable) {
          case "env":
            if (argument) {
              if (environment.env) {
                const env2 = environment.env[$l ? argument.toLowerCase() : argument];
                if ($zg(env2)) {
                  return env2;
                }
              }
              return "";
            }
            throw new $oY(VariableKind.Env, localize(12640, null, match));
          case "config":
            if (argument) {
              const config = this.a.getConfigurationValue(folderUri, argument);
              if ($Ig(config)) {
                throw new $oY(VariableKind.Config, localize(12641, null, match, argument));
              }
              if ($Bg(config)) {
                throw new $oY(VariableKind.Config, localize(12642, null, match, argument));
              }
              return config;
            }
            throw new $oY(VariableKind.Config, localize(12643, null, match));
          case "command":
            return this.p(VariableKind.Command, match, argument, commandValueMapping, "command");
          case "input":
            return this.p(VariableKind.Input, match, argument, commandValueMapping, "input");
          case "extensionInstallFolder":
            if (argument) {
              const ext = await this.a.getExtension(argument);
              if (!ext) {
                throw new $oY(VariableKind.ExtensionInstallFolder, localize(12644, null, match, argument));
              }
              return this.n(ext.extensionLocation);
            }
            throw new $oY(VariableKind.ExtensionInstallFolder, localize(12645, null, match));
          default: {
            switch (variable) {
              case "workspaceRoot":
              case "workspaceFolder":
                return $1t(this.n(getFolderUri(VariableKind.WorkspaceFolder)));
              case "cwd":
                return folderUri || argument ? $1t(this.n(getFolderUri(VariableKind.Cwd))) : cwd();
              case "workspaceRootFolderName":
              case "workspaceFolderBasename":
                return $1t($rc(this.n(getFolderUri(VariableKind.WorkspaceFolderBasename))));
              case "userHome": {
                if (environment.userHome) {
                  return environment.userHome;
                }
                throw new $oY(VariableKind.UserHome, localize(12646, null, match));
              }
              case "lineNumber": {
                const lineNumber = this.a.getLineNumber();
                if (lineNumber) {
                  return lineNumber;
                }
                throw new $oY(VariableKind.LineNumber, localize(12647, null, match));
              }
              case "selectedText": {
                const selectedText = this.a.getSelectedText();
                if (selectedText) {
                  return selectedText;
                }
                throw new $oY(VariableKind.SelectedText, localize(12648, null, match));
              }
              case "file":
                return getFilePath(VariableKind.File);
              case "fileWorkspaceFolder":
                return getFolderPathForFile(VariableKind.FileWorkspaceFolder);
              case "fileWorkspaceFolderBasename":
                return $rc(getFolderPathForFile(VariableKind.FileWorkspaceFolderBasename));
              case "relativeFile":
                if (folderUri || argument) {
                  return $pc(this.n(getFolderUri(VariableKind.RelativeFile)), getFilePath(VariableKind.RelativeFile));
                }
                return getFilePath(VariableKind.RelativeFile);
              case "relativeFileDirname": {
                const dirname5 = $qc(getFilePath(VariableKind.RelativeFileDirname));
                if (folderUri || argument) {
                  const relative2 = $pc(this.n(getFolderUri(VariableKind.RelativeFileDirname)), dirname5);
                  return relative2.length === 0 ? "." : relative2;
                }
                return dirname5;
              }
              case "fileDirname":
                return $qc(getFilePath(VariableKind.FileDirname));
              case "fileExtname":
                return $sc(getFilePath(VariableKind.FileExtname));
              case "fileBasename":
                return $rc(getFilePath(VariableKind.FileBasename));
              case "fileBasenameNoExtension": {
                const basename = $rc(getFilePath(VariableKind.FileBasenameNoExtension));
                return basename.slice(0, basename.length - $sc(basename).length);
              }
              case "fileDirnameBasename":
                return $rc($qc(getFilePath(VariableKind.FileDirnameBasename)));
              case "execPath": {
                const ep = this.a.getExecPath();
                if (ep) {
                  return ep;
                }
                return match;
              }
              case "execInstallFolder": {
                const ar = this.a.getAppRoot();
                if (ar) {
                  return ar;
                }
                return match;
              }
              case "pathSeparator":
              case "/":
                return sep;
              default:
                try {
                  const key = argument ? `${variable}:${argument}` : variable;
                  return this.p(VariableKind.Unknown, match, key, commandValueMapping, void 0);
                } catch (error) {
                  return match;
                }
            }
          }
        }
      }
      p(variableKind, match, argument, commandValueMapping, prefix) {
        if (argument && commandValueMapping) {
          const v = prefix === void 0 ? commandValueMapping[argument] : commandValueMapping[prefix + ":" + argument];
          if (typeof v === "string") {
            return v;
          }
          throw new $oY(variableKind, localize(12649, null, match));
        }
        return match;
      }
    };
  }
});

// out-build/vs/server/node/remoteTerminalChannel.js
import * as os4 from "os";
var CustomVariableResolver, $EY;
var init_remoteTerminalChannel = __esm({
  "out-build/vs/server/node/remoteTerminalChannel.js"() {
    "use strict";
    init_event();
    init_objects();
    init_lifecycle();
    init_path();
    init_platform();
    init_uri();
    init_ipc_net2();
    init_uriTransformer();
    init_extHostCLIServer();
    init_environmentVariableCollection();
    init_environmentVariableShared();
    init_terminalEnvironment3();
    init_variableResolver();
    init_extensionHostConnection();
    init_async();
    init_terminalEnvironment2();
    CustomVariableResolver = class extends $DY {
      constructor(env2, workspaceFolders, activeFileResource, resolvedVariables, extensionService) {
        super({
          getFolderUri: (folderName) => {
            const found = workspaceFolders.filter((f) => f.name === folderName);
            if (found && found.length > 0) {
              return found[0].uri;
            }
            return void 0;
          },
          getWorkspaceFolderCount: () => {
            return workspaceFolders.length;
          },
          getConfigurationValue: (folderUri, section) => {
            return resolvedVariables[`config:${section}`];
          },
          getExecPath: () => {
            return env2["VSCODE_EXEC_PATH"];
          },
          getAppRoot: () => {
            return env2["VSCODE_CWD"];
          },
          getFilePath: () => {
            if (activeFileResource) {
              return $lc(activeFileResource.fsPath);
            }
            return void 0;
          },
          getSelectedText: () => {
            return resolvedVariables["selectedText"];
          },
          getLineNumber: () => {
            return resolvedVariables["lineNumber"];
          },
          getExtension: async (id2) => {
            const installed = await extensionService.getInstalled();
            const found = installed.find((e) => e.identifier.id === id2);
            return found && { extensionLocation: found.location };
          }
        }, void 0, Promise.resolve(os4.homedir()), Promise.resolve(env2));
      }
    };
    $EY = class extends $3c {
      constructor(g, h, j, m, n, r) {
        super();
        this.g = g;
        this.h = h;
        this.j = j;
        this.m = m;
        this.n = n;
        this.r = r;
        this.a = 0;
        this.b = /* @__PURE__ */ new Map();
        this.c = this.B(new $ze());
        this.onExecuteCommand = this.c.event;
      }
      async call(ctx, command, args) {
        switch (command) {
          case "$restartPtyHost":
            return this.j.restartPtyHost.apply(this.j, args);
          case "$createProcess": {
            const uriTransformer = $FX(ctx.remoteAuthority);
            return this.s(uriTransformer, args);
          }
          case "$attachToProcess":
            return this.j.attachToProcess.apply(this.j, args);
          case "$detachFromProcess":
            return this.j.detachFromProcess.apply(this.j, args);
          case "$listProcesses":
            return this.j.listProcesses.apply(this.j, args);
          case "$getLatency":
            return this.j.getLatency.apply(this.j, args);
          case "$getPerformanceMarks":
            return this.j.getPerformanceMarks.apply(this.j, args);
          case "$orphanQuestionReply":
            return this.j.orphanQuestionReply.apply(this.j, args);
          case "$acceptPtyHostResolvedVariables":
            return this.j.acceptPtyHostResolvedVariables.apply(this.j, args);
          case "$start":
            return this.j.start.apply(this.j, args);
          case "$input":
            return this.j.input.apply(this.j, args);
          case "$acknowledgeDataEvent":
            return this.j.acknowledgeDataEvent.apply(this.j, args);
          case "$shutdown":
            return this.j.shutdown.apply(this.j, args);
          case "$resize":
            return this.j.resize.apply(this.j, args);
          case "$clearBuffer":
            return this.j.clearBuffer.apply(this.j, args);
          case "$getInitialCwd":
            return this.j.getInitialCwd.apply(this.j, args);
          case "$getCwd":
            return this.j.getCwd.apply(this.j, args);
          case "$processBinary":
            return this.j.processBinary.apply(this.j, args);
          case "$sendCommandResult":
            return this.u(args[0], args[1], args[2]);
          case "$installAutoReply":
            return this.j.installAutoReply.apply(this.j, args);
          case "$uninstallAllAutoReplies":
            return this.j.uninstallAllAutoReplies.apply(this.j, args);
          case "$getDefaultSystemShell":
            return this.w.apply(this, args);
          case "$getProfiles":
            return this.y.apply(this, args);
          case "$getEnvironment":
            return this.z();
          case "$getWslPath":
            return this.C(args[0], args[1]);
          case "$getTerminalLayoutInfo":
            return this.j.getTerminalLayoutInfo(args);
          case "$setTerminalLayoutInfo":
            return this.j.setTerminalLayoutInfo(args);
          case "$serializeTerminalState":
            return this.j.serializeTerminalState.apply(this.j, args);
          case "$reviveTerminalProcesses":
            return this.j.reviveTerminalProcesses.apply(this.j, args);
          case "$getRevivedPtyNewId":
            return this.j.getRevivedPtyNewId.apply(this.j, args);
          case "$setUnicodeVersion":
            return this.j.setUnicodeVersion.apply(this.j, args);
          case "$reduceConnectionGraceTime":
            return this.D();
          case "$updateIcon":
            return this.j.updateIcon.apply(this.j, args);
          case "$updateTitle":
            return this.j.updateTitle.apply(this.j, args);
          case "$updateProperty":
            return this.j.updateProperty.apply(this.j, args);
          case "$refreshProperty":
            return this.j.refreshProperty.apply(this.j, args);
          case "$requestDetachInstance":
            return this.j.requestDetachInstance(args[0], args[1]);
          case "$acceptDetachedInstance":
            return this.j.acceptDetachInstanceReply(args[0], args[1]);
          case "$freePortKillProcess":
            return this.j.freePortKillProcess.apply(this.j, args);
          case "$acceptDetachInstanceReply":
            return this.j.acceptDetachInstanceReply.apply(this.j, args);
        }
        throw new Error(`IPC Command ${command} not found`);
      }
      listen(_, event, arg) {
        switch (event) {
          case "$onPtyHostExitEvent":
            return this.j.onPtyHostExit || Event.None;
          case "$onPtyHostStartEvent":
            return this.j.onPtyHostStart || Event.None;
          case "$onPtyHostUnresponsiveEvent":
            return this.j.onPtyHostUnresponsive || Event.None;
          case "$onPtyHostResponsiveEvent":
            return this.j.onPtyHostResponsive || Event.None;
          case "$onPtyHostRequestResolveVariablesEvent":
            return this.j.onPtyHostRequestResolveVariables || Event.None;
          case "$onProcessDataEvent":
            return this.j.onProcessData;
          case "$onProcessReadyEvent":
            return this.j.onProcessReady;
          case "$onProcessExitEvent":
            return this.j.onProcessExit;
          case "$onProcessReplayEvent":
            return this.j.onProcessReplay;
          case "$onProcessOrphanQuestion":
            return this.j.onProcessOrphanQuestion;
          case "$onExecuteCommand":
            return this.onExecuteCommand;
          case "$onDidRequestDetach":
            return this.j.onDidRequestDetach || Event.None;
          case "$onDidChangeProperty":
            return this.j.onDidChangeProperty;
        }
        throw new Error(`IPC Command ${event} not found`);
      }
      async s(uriTransformer, args) {
        const shellLaunchConfig = {
          name: args.shellLaunchConfig.name,
          executable: args.shellLaunchConfig.executable,
          args: args.shellLaunchConfig.args,
          cwd: typeof args.shellLaunchConfig.cwd === "string" || typeof args.shellLaunchConfig.cwd === "undefined" ? args.shellLaunchConfig.cwd : URI.revive(uriTransformer.transformIncoming(args.shellLaunchConfig.cwd)),
          env: args.shellLaunchConfig.env,
          useShellEnvironment: args.shellLaunchConfig.useShellEnvironment,
          reconnectionProperties: args.shellLaunchConfig.reconnectionProperties,
          type: args.shellLaunchConfig.type,
          isFeatureTerminal: args.shellLaunchConfig.isFeatureTerminal
        };
        const baseEnv = await $WW(args.resolverEnv, !!args.shellLaunchConfig.useShellEnvironment, $z, this.g, this.h, this.r);
        this.h.trace("baseEnv", baseEnv);
        const reviveWorkspaceFolder = (workspaceData) => {
          return {
            uri: URI.revive(uriTransformer.transformIncoming(workspaceData.uri)),
            name: workspaceData.name,
            index: workspaceData.index,
            toResource: () => {
              throw new Error("Not implemented");
            }
          };
        };
        const workspaceFolders = args.workspaceFolders.map(reviveWorkspaceFolder);
        const activeWorkspaceFolder = args.activeWorkspaceFolder ? reviveWorkspaceFolder(args.activeWorkspaceFolder) : void 0;
        const activeFileResource = args.activeFileResource ? URI.revive(uriTransformer.transformIncoming(args.activeFileResource)) : void 0;
        const customVariableResolver = new CustomVariableResolver(baseEnv, workspaceFolders, activeFileResource, args.resolvedVariables, this.n);
        const variableResolver = $zY(activeWorkspaceFolder, process.env, customVariableResolver);
        const initialCwd = await $yY(shellLaunchConfig, os4.homedir(), variableResolver, activeWorkspaceFolder?.uri, args.configuration["terminal.integrated.cwd"], this.h);
        shellLaunchConfig.cwd = initialCwd;
        const envPlatformKey = $l ? "terminal.integrated.env.windows" : $m ? "terminal.integrated.env.osx" : "terminal.integrated.env.linux";
        const envFromConfig = args.configuration[envPlatformKey];
        const env2 = await $AY(shellLaunchConfig, envFromConfig, variableResolver, this.m.version, args.configuration["terminal.integrated.detectLocale"], baseEnv);
        if ($sY(shellLaunchConfig)) {
          const entries = [];
          for (const [k, v, d] of args.envVariableCollections) {
            entries.push([k, { map: $DB(v), descriptionMap: $EB(d) }]);
          }
          const envVariableCollections = new Map(entries);
          const mergedCollection = new $HB(envVariableCollections);
          const workspaceFolder = activeWorkspaceFolder ? activeWorkspaceFolder ?? void 0 : void 0;
          await mergedCollection.applyToProcessEnvironment(env2, { workspaceFolder }, variableResolver);
        }
        this.h.debug(`Terminal process launching on remote agent`, { shellLaunchConfig, initialCwd, cols: args.cols, rows: args.rows, env: env2 });
        const ipcHandlePath = $xu();
        env2.VSCODE_IPC_HOOK_CLI = ipcHandlePath;
        const persistentProcessId = await this.j.createProcess(shellLaunchConfig, initialCwd, args.cols, args.rows, args.unicodeVersion, env2, baseEnv, args.options, args.shouldPersistTerminal, args.workspaceId, args.workspaceName);
        const commandsExecuter = {
          executeCommand: (id2, ...args2) => this.t(persistentProcessId, id2, args2, uriTransformer)
        };
        const cliServer = new $HW(commandsExecuter, this.h, ipcHandlePath);
        this.j.onProcessExit((e) => e.id === persistentProcessId && cliServer.dispose());
        return {
          persistentTerminalId: persistentProcessId,
          resolvedShellLaunchConfig: shellLaunchConfig
        };
      }
      t(persistentProcessId, commandId, commandArgs, uriTransformer) {
        const { resolve: resolve4, reject, promise } = $Oh();
        const reqId = ++this.a;
        this.b.set(reqId, { resolve: resolve4, reject, uriTransformer });
        const serializedCommandArgs = $Nv(commandArgs, (obj) => {
          if (obj && obj.$mid === 1) {
            return uriTransformer.transformOutgoing(obj);
          }
          if (obj && obj instanceof URI) {
            return uriTransformer.transformOutgoingURI(obj);
          }
          return void 0;
        });
        this.c.fire({
          reqId,
          persistentProcessId,
          commandId,
          commandArgs: serializedCommandArgs
        });
        return promise;
      }
      u(reqId, isError, serializedPayload) {
        const data = this.b.get(reqId);
        if (!data) {
          return;
        }
        this.b.delete(reqId);
        const payload = $Nv(serializedPayload, (obj) => {
          if (obj && obj.$mid === 1) {
            return data.uriTransformer.transformIncoming(obj);
          }
          return void 0;
        });
        if (isError) {
          data.reject(payload);
        } else {
          data.resolve(payload);
        }
      }
      w(osOverride) {
        return this.j.getDefaultSystemShell(osOverride);
      }
      async y(workspaceId, profiles, defaultProfile, includeDetectedProfiles) {
        return this.j.getProfiles(workspaceId, profiles, defaultProfile, includeDetectedProfiles) || [];
      }
      z() {
        return { ...process.env };
      }
      C(original, direction) {
        return this.j.getWslPath(original, direction);
      }
      D() {
        return this.j.reduceConnectionGraceTime();
      }
    };
  }
});

// out-build/vs/workbench/services/configuration/common/configuration.js
var $iK, $jK, $kK, $vK, $wK, $AK, $BK, $CK, $DK, $EK;
var init_configuration2 = __esm({
  "out-build/vs/workbench/services/configuration/common/configuration.js"() {
    "use strict";
    init_configuration();
    init_instantiation();
    $iK = ".vscode";
    $jK = "settings";
    $kK = `${$iK}/${$jK}.json`;
    $vK = [
      3,
      4,
      5
      /* ConfigurationScope.LANGUAGE_OVERRIDABLE */
    ];
    $wK = [1, ...$vK];
    $AK = "tasks";
    $BK = "launch";
    $CK = /* @__PURE__ */ Object.create(null);
    $CK[$AK] = `${$iK}/${$AK}.json`;
    $CK[$BK] = `${$iK}/${$BK}.json`;
    $DK = /* @__PURE__ */ Object.create(null);
    $DK[$AK] = `${$AK}.json`;
    $EK = $Rk($kl);
  }
});

// out-build/vs/platform/label/common/label.js
var $ZI, Verbosity2;
var init_label = __esm({
  "out-build/vs/platform/label/common/label.js"() {
    "use strict";
    init_instantiation();
    $ZI = $Qk("labelService");
    (function(Verbosity3) {
      Verbosity3[Verbosity3["SHORT"] = 0] = "SHORT";
      Verbosity3[Verbosity3["MEDIUM"] = 1] = "MEDIUM";
      Verbosity3[Verbosity3["LONG"] = 2] = "LONG";
    })(Verbosity2 || (Verbosity2 = {}));
  }
});

// out-build/vs/workbench/contrib/terminal/common/environmentVariable.js
var $NX;
var init_environmentVariable2 = __esm({
  "out-build/vs/workbench/contrib/terminal/common/environmentVariable.js"() {
    "use strict";
    init_instantiation();
    $NX = $Qk("environmentVariableService");
  }
});

// out-build/vs/workbench/contrib/terminal/common/remote/remoteTerminalChannel.js
var $FY, $GY;
var init_remoteTerminalChannel2 = __esm({
  "out-build/vs/workbench/contrib/terminal/common/remote/remoteTerminalChannel.js"() {
    "use strict";
    init_configuration2();
    init_remoteAuthorityResolver();
    init_workspace();
    init_environmentVariableShared();
    init_configurationResolver();
    init_editor();
    init_editorService();
    init_network();
    init_label();
    init_environmentVariable2();
    init_terminal();
    $FY = "remoteterminal";
    $GY = class $GY2 {
      get onPtyHostExit() {
        return this.b.listen(
          "$onPtyHostExitEvent"
          /* RemoteTerminalChannelEvent.OnPtyHostExitEvent */
        );
      }
      get onPtyHostStart() {
        return this.b.listen(
          "$onPtyHostStartEvent"
          /* RemoteTerminalChannelEvent.OnPtyHostStartEvent */
        );
      }
      get onPtyHostUnresponsive() {
        return this.b.listen(
          "$onPtyHostUnresponsiveEvent"
          /* RemoteTerminalChannelEvent.OnPtyHostUnresponsiveEvent */
        );
      }
      get onPtyHostResponsive() {
        return this.b.listen(
          "$onPtyHostResponsiveEvent"
          /* RemoteTerminalChannelEvent.OnPtyHostResponsiveEvent */
        );
      }
      get onPtyHostRequestResolveVariables() {
        return this.b.listen(
          "$onPtyHostRequestResolveVariablesEvent"
          /* RemoteTerminalChannelEvent.OnPtyHostRequestResolveVariablesEvent */
        );
      }
      get onProcessData() {
        return this.b.listen(
          "$onProcessDataEvent"
          /* RemoteTerminalChannelEvent.OnProcessDataEvent */
        );
      }
      get onProcessExit() {
        return this.b.listen(
          "$onProcessExitEvent"
          /* RemoteTerminalChannelEvent.OnProcessExitEvent */
        );
      }
      get onProcessReady() {
        return this.b.listen(
          "$onProcessReadyEvent"
          /* RemoteTerminalChannelEvent.OnProcessReadyEvent */
        );
      }
      get onProcessReplay() {
        return this.b.listen(
          "$onProcessReplayEvent"
          /* RemoteTerminalChannelEvent.OnProcessReplayEvent */
        );
      }
      get onProcessOrphanQuestion() {
        return this.b.listen(
          "$onProcessOrphanQuestion"
          /* RemoteTerminalChannelEvent.OnProcessOrphanQuestion */
        );
      }
      get onExecuteCommand() {
        return this.b.listen(
          "$onExecuteCommand"
          /* RemoteTerminalChannelEvent.OnExecuteCommand */
        );
      }
      get onDidRequestDetach() {
        return this.b.listen(
          "$onDidRequestDetach"
          /* RemoteTerminalChannelEvent.OnDidRequestDetach */
        );
      }
      get onDidChangeProperty() {
        return this.b.listen(
          "$onDidChangeProperty"
          /* RemoteTerminalChannelEvent.OnDidChangeProperty */
        );
      }
      constructor(a, b, c, d, e, f, g, h, i, j) {
        this.a = a;
        this.b = b;
        this.c = c;
        this.d = d;
        this.e = e;
        this.f = f;
        this.g = g;
        this.h = h;
        this.i = i;
        this.j = j;
      }
      restartPtyHost() {
        return this.b.call("$restartPtyHost", []);
      }
      async createProcess(shellLaunchConfig, configuration, activeWorkspaceRootUri, options2, shouldPersistTerminal, cols, rows, unicodeVersion) {
        await this.c.whenRemoteConfigurationLoaded();
        const resolvedVariables = /* @__PURE__ */ Object.create(null);
        const lastActiveWorkspace = activeWorkspaceRootUri ? this.d.getWorkspaceFolder(activeWorkspaceRootUri) ?? void 0 : void 0;
        let allResolvedVariables = void 0;
        try {
          allResolvedVariables = (await this.e.resolveAnyMap(lastActiveWorkspace, {
            shellLaunchConfig,
            configuration
          })).resolvedVariables;
        } catch (err) {
          this.h.error(err);
        }
        if (allResolvedVariables) {
          for (const [name, value] of allResolvedVariables.entries()) {
            if (/^config:/.test(name) || name === "selectedText" || name === "lineNumber") {
              resolvedVariables[name] = value;
            }
          }
        }
        const envVariableCollections = [];
        for (const [k, v] of this.f.collections.entries()) {
          envVariableCollections.push([k, $BB(v.map), $CB(v.descriptionMap)]);
        }
        const resolverResult = await this.g.resolveAuthority(this.a);
        const resolverEnv = resolverResult.options && resolverResult.options.extensionHostEnv;
        const workspace = this.d.getWorkspace();
        const workspaceFolders = workspace.folders;
        const activeWorkspaceFolder = activeWorkspaceRootUri ? this.d.getWorkspaceFolder(activeWorkspaceRootUri) : null;
        const activeFileResource = $mL.getOriginalUri(this.i.activeEditor, {
          supportSideBySide: SideBySideEditor.PRIMARY,
          filterByScheme: [Schemas.file, Schemas.vscodeUserData, Schemas.vscodeRemote]
        });
        const args = {
          configuration,
          resolvedVariables,
          envVariableCollections,
          shellLaunchConfig,
          workspaceId: workspace.id,
          workspaceName: this.j.getWorkspaceLabel(workspace),
          workspaceFolders,
          activeWorkspaceFolder,
          activeFileResource,
          shouldPersistTerminal,
          options: options2,
          cols,
          rows,
          unicodeVersion,
          resolverEnv
        };
        return await this.b.call("$createProcess", args);
      }
      requestDetachInstance(workspaceId, instanceId) {
        return this.b.call("$requestDetachInstance", [workspaceId, instanceId]);
      }
      acceptDetachInstanceReply(requestId, persistentProcessId) {
        return this.b.call("$acceptDetachInstanceReply", [requestId, persistentProcessId]);
      }
      attachToProcess(id2) {
        return this.b.call("$attachToProcess", [id2]);
      }
      detachFromProcess(id2, forcePersist) {
        return this.b.call("$detachFromProcess", [id2, forcePersist]);
      }
      listProcesses() {
        return this.b.call(
          "$listProcesses"
          /* RemoteTerminalChannelRequest.ListProcesses */
        );
      }
      getLatency() {
        return this.b.call(
          "$getLatency"
          /* RemoteTerminalChannelRequest.GetLatency */
        );
      }
      getPerformanceMarks() {
        return this.b.call(
          "$getPerformanceMarks"
          /* RemoteTerminalChannelRequest.GetPerformanceMarks */
        );
      }
      reduceConnectionGraceTime() {
        return this.b.call(
          "$reduceConnectionGraceTime"
          /* RemoteTerminalChannelRequest.ReduceConnectionGraceTime */
        );
      }
      processBinary(id2, data) {
        return this.b.call("$processBinary", [id2, data]);
      }
      start(id2) {
        return this.b.call("$start", [id2]);
      }
      input(id2, data) {
        return this.b.call("$input", [id2, data]);
      }
      acknowledgeDataEvent(id2, charCount) {
        return this.b.call("$acknowledgeDataEvent", [id2, charCount]);
      }
      setUnicodeVersion(id2, version) {
        return this.b.call("$setUnicodeVersion", [id2, version]);
      }
      shutdown(id2, immediate) {
        return this.b.call("$shutdown", [id2, immediate]);
      }
      resize(id2, cols, rows) {
        return this.b.call("$resize", [id2, cols, rows]);
      }
      clearBuffer(id2) {
        return this.b.call("$clearBuffer", [id2]);
      }
      getInitialCwd(id2) {
        return this.b.call("$getInitialCwd", [id2]);
      }
      getCwd(id2) {
        return this.b.call("$getCwd", [id2]);
      }
      orphanQuestionReply(id2) {
        return this.b.call("$orphanQuestionReply", [id2]);
      }
      sendCommandResult(reqId, isError, payload) {
        return this.b.call("$sendCommandResult", [reqId, isError, payload]);
      }
      freePortKillProcess(port) {
        return this.b.call("$freePortKillProcess", [port]);
      }
      getDefaultSystemShell(osOverride) {
        return this.b.call("$getDefaultSystemShell", [osOverride]);
      }
      getProfiles(profiles, defaultProfile, includeDetectedProfiles) {
        return this.b.call("$getProfiles", [this.d.getWorkspace().id, profiles, defaultProfile, includeDetectedProfiles]);
      }
      acceptPtyHostResolvedVariables(requestId, resolved) {
        return this.b.call("$acceptPtyHostResolvedVariables", [requestId, resolved]);
      }
      getEnvironment() {
        return this.b.call(
          "$getEnvironment"
          /* RemoteTerminalChannelRequest.GetEnvironment */
        );
      }
      getWslPath(original, direction) {
        return this.b.call("$getWslPath", [original, direction]);
      }
      setTerminalLayoutInfo(layout) {
        const workspace = this.d.getWorkspace();
        const args = {
          workspaceId: workspace.id,
          tabs: layout ? layout.tabs : []
        };
        return this.b.call("$setTerminalLayoutInfo", args);
      }
      updateTitle(id2, title, titleSource) {
        return this.b.call("$updateTitle", [id2, title, titleSource]);
      }
      updateIcon(id2, userInitiated, icon, color2) {
        return this.b.call("$updateIcon", [id2, userInitiated, icon, color2]);
      }
      refreshProperty(id2, property) {
        return this.b.call("$refreshProperty", [id2, property]);
      }
      updateProperty(id2, property, value) {
        return this.b.call("$updateProperty", [id2, property, value]);
      }
      getTerminalLayoutInfo() {
        const workspace = this.d.getWorkspace();
        const args = {
          workspaceId: workspace.id
        };
        return this.b.call("$getTerminalLayoutInfo", args);
      }
      reviveTerminalProcesses(workspaceId, state, dateTimeFormatLocate) {
        return this.b.call("$reviveTerminalProcesses", [workspaceId, state, dateTimeFormatLocate]);
      }
      getRevivedPtyNewId(id2) {
        return this.b.call("$getRevivedPtyNewId", [id2]);
      }
      serializeTerminalState(ids) {
        return this.b.call("$serializeTerminalState", [ids]);
      }
      // #region Pty service contribution RPC calls
      installAutoReply(match, reply) {
        return this.b.call("$installAutoReply", [match, reply]);
      }
      uninstallAllAutoReplies() {
        return this.b.call("$uninstallAllAutoReplies", []);
      }
    };
    $GY = __decorate([
      __param(2, $EK),
      __param(3, $Zk),
      __param(4, $nY),
      __param(5, $NX),
      __param(6, $bC),
      __param(7, $8x),
      __param(8, $mJ),
      __param(9, $ZI)
    ], $GY);
  }
});

// out-build/vs/platform/files/common/diskFileSystemProviderClient.js
var init_diskFileSystemProviderClient = __esm({
  "out-build/vs/platform/files/common/diskFileSystemProviderClient.js"() {
    "use strict";
    init_buffer();
    init_errorMessage();
    init_errors();
    init_event();
    init_lifecycle();
    init_stream();
    init_uuid();
    init_files();
    init_watcher();
  }
});

// out-build/vs/workbench/services/remote/common/remoteFileSystemProviderClient.js
var $HY;
var init_remoteFileSystemProviderClient = __esm({
  "out-build/vs/workbench/services/remote/common/remoteFileSystemProviderClient.js"() {
    "use strict";
    init_errors();
    init_lifecycle();
    init_network();
    init_diskFileSystemProviderClient();
    $HY = "remoteFilesystem";
  }
});

// out-build/vs/amdX.js
async function $sJ(nodeModuleName, pathInsideNodeModule, isBuilt) {
  if (isBuilt === void 0) {
    const product2 = globalThis._VSCODE_PRODUCT_JSON;
    isBuilt = Boolean((product2 ?? globalThis.vscode?.context?.configuration()?.product)?.commit);
  }
  const nodeModulePath = pathInsideNodeModule ? `${nodeModuleName}/${pathInsideNodeModule}` : nodeModuleName;
  if (cache.has(nodeModulePath)) {
    return cache.get(nodeModulePath);
  }
  let scriptSrc;
  if (/^\w[\w\d+.-]*:\/\//.test(nodeModulePath)) {
    scriptSrc = nodeModulePath;
  } else {
    const useASAR = $rJ && isBuilt && !$r;
    const actualNodeModulesPath = useASAR ? $fh : $eh;
    const resourcePath = `${actualNodeModulesPath}/${nodeModulePath}`;
    scriptSrc = $ih.asBrowserUri(resourcePath).toString(true);
  }
  const result = AMDModuleImporter.INSTANCE.load(scriptSrc);
  cache.set(nodeModulePath, result);
  return result;
}
var $rJ, DefineCall, AMDModuleImporterState, AMDModuleImporter, cache;
var init_amdX = __esm({
  "out-build/vs/amdX.js"() {
    "use strict";
    init_network();
    init_platform();
    init_uri();
    init_uuid();
    $rJ = false;
    DefineCall = class {
      constructor(id2, dependencies, callback) {
        this.id = id2;
        this.dependencies = dependencies;
        this.callback = callback;
      }
    };
    (function(AMDModuleImporterState2) {
      AMDModuleImporterState2[AMDModuleImporterState2["Uninitialized"] = 1] = "Uninitialized";
      AMDModuleImporterState2[AMDModuleImporterState2["InitializedInternal"] = 2] = "InitializedInternal";
      AMDModuleImporterState2[AMDModuleImporterState2["InitializedExternal"] = 3] = "InitializedExternal";
    })(AMDModuleImporterState || (AMDModuleImporterState = {}));
    AMDModuleImporter = class _AMDModuleImporter {
      static {
        this.INSTANCE = new _AMDModuleImporter();
      }
      constructor() {
        this.a = typeof self === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope";
        this.b = typeof document === "object";
        this.c = [];
        this.d = AMDModuleImporterState.Uninitialized;
      }
      g() {
        if (this.d === AMDModuleImporterState.Uninitialized) {
          if (globalThis.define) {
            this.d = AMDModuleImporterState.InitializedExternal;
            return;
          }
        } else {
          return;
        }
        this.d = AMDModuleImporterState.InitializedInternal;
        globalThis.define = (id2, dependencies, callback) => {
          if (typeof id2 !== "string") {
            callback = dependencies;
            dependencies = id2;
            id2 = null;
          }
          if (typeof dependencies !== "object" || !Array.isArray(dependencies)) {
            callback = dependencies;
            dependencies = null;
          }
          this.c.push(new DefineCall(id2, dependencies, callback));
        };
        globalThis.define.amd = true;
        if (this.b) {
          this.f = globalThis._VSCODE_WEB_PACKAGE_TTP ?? window.trustedTypes?.createPolicy("amdLoader", {
            createScriptURL(value) {
              if (value.startsWith(window.location.origin)) {
                return value;
              }
              if (value.startsWith(`${Schemas.vscodeFileResource}://${$hh}`)) {
                return value;
              }
              throw new Error(`[trusted_script_src] Invalid script url: ${value}`);
            }
          });
        } else if (this.a) {
          this.f = globalThis._VSCODE_WEB_PACKAGE_TTP ?? globalThis.trustedTypes?.createPolicy("amdLoader", {
            createScriptURL(value) {
              return value;
            }
          });
        }
      }
      async load(scriptSrc) {
        this.g();
        if (this.d === AMDModuleImporterState.InitializedExternal) {
          return new Promise((resolve4) => {
            const tmpModuleId = $ps();
            globalThis.define(tmpModuleId, [scriptSrc], function(moduleResult) {
              resolve4(moduleResult);
            });
          });
        }
        const defineCall = await (this.a ? this.i(scriptSrc) : this.b ? this.h(scriptSrc) : this.j(scriptSrc));
        if (!defineCall) {
          console.warn(`Did not receive a define call from script ${scriptSrc}`);
          return void 0;
        }
        const exports2 = {};
        const dependencyObjs = [];
        const dependencyModules = [];
        if (Array.isArray(defineCall.dependencies)) {
          for (const mod of defineCall.dependencies) {
            if (mod === "exports") {
              dependencyObjs.push(exports2);
            } else {
              dependencyModules.push(mod);
            }
          }
        }
        if (dependencyModules.length > 0) {
          throw new Error(`Cannot resolve dependencies for script ${scriptSrc}. The dependencies are: ${dependencyModules.join(", ")}`);
        }
        if (typeof defineCall.callback === "function") {
          return defineCall.callback(...dependencyObjs) ?? exports2;
        } else {
          return defineCall.callback;
        }
      }
      h(scriptSrc) {
        return new Promise((resolve4, reject) => {
          const scriptElement = document.createElement("script");
          scriptElement.setAttribute("async", "async");
          scriptElement.setAttribute("type", "text/javascript");
          const unbind = () => {
            scriptElement.removeEventListener("load", loadEventListener);
            scriptElement.removeEventListener("error", errorEventListener);
          };
          const loadEventListener = (e) => {
            unbind();
            resolve4(this.c.pop());
          };
          const errorEventListener = (e) => {
            unbind();
            reject(e);
          };
          scriptElement.addEventListener("load", loadEventListener);
          scriptElement.addEventListener("error", errorEventListener);
          if (this.f) {
            scriptSrc = this.f.createScriptURL(scriptSrc);
          }
          scriptElement.setAttribute("src", scriptSrc);
          window.document.getElementsByTagName("head")[0].appendChild(scriptElement);
        });
      }
      async i(scriptSrc) {
        if (this.f) {
          scriptSrc = this.f.createScriptURL(scriptSrc);
        }
        await import(scriptSrc);
        return this.c.pop();
      }
      async j(scriptSrc) {
        try {
          const fs15 = (await import(`${"fs"}`)).default;
          const vm = (await import(`${"vm"}`)).default;
          const module2 = (await import(`${"module"}`)).default;
          const filePath = URI.parse(scriptSrc).fsPath;
          const content = fs15.readFileSync(filePath).toString();
          const scriptSource = module2.wrap(content.replace(/^#!.*/, ""));
          const script = new vm.Script(scriptSource);
          const compileWrapper = script.runInThisContext();
          compileWrapper.apply();
          return this.c.pop();
        } catch (error) {
          throw error;
        }
      }
    };
    cache = /* @__PURE__ */ new Map();
  }
});

// out-build/vs/platform/telemetry/common/1dsAppender.js
async function getClient(instrumentationKey, addInternalFlag, xhrOverride) {
  const oneDs = $r ? await $sJ("@microsoft/1ds-core-js", "bundle/ms.core.min.js") : await import("@microsoft/1ds-core-js");
  const postPlugin = $r ? await $sJ("@microsoft/1ds-post-js", "bundle/ms.post.min.js") : await import("@microsoft/1ds-post-js");
  const appInsightsCore = new oneDs.AppInsightsCore();
  const collectorChannelPlugin = new postPlugin.PostChannel();
  const coreConfig = {
    instrumentationKey,
    endpointUrl,
    loggingLevelTelemetry: 0,
    loggingLevelConsole: 0,
    disableCookiesUsage: true,
    disableDbgExt: true,
    disableInstrumentationKeyValidation: true,
    channels: [[
      collectorChannelPlugin
    ]]
  };
  if (xhrOverride) {
    coreConfig.extensionConfig = {};
    const channelConfig = {
      alwaysUseXhrOverride: true,
      ignoreMc1Ms0CookieProcessing: true,
      httpXHROverride: xhrOverride
    };
    coreConfig.extensionConfig[collectorChannelPlugin.identifier] = channelConfig;
  }
  appInsightsCore.initialize(coreConfig, []);
  appInsightsCore.addTelemetryInitializer((envelope) => {
    envelope["ext"] = envelope["ext"] ?? {};
    envelope["ext"]["web"] = envelope["ext"]["web"] ?? {};
    envelope["ext"]["web"]["consentDetails"] = '{"GPC_DataSharingOptIn":false}';
    if (addInternalFlag) {
      envelope["ext"]["utc"] = envelope["ext"]["utc"] ?? {};
      envelope["ext"]["utc"]["flags"] = 8462029;
    }
  });
  return appInsightsCore;
}
var endpointUrl, endpointHealthUrl, $KY;
var init_dsAppender = __esm({
  "out-build/vs/platform/telemetry/common/1dsAppender.js"() {
    "use strict";
    init_amdX();
    init_errors();
    init_objects();
    init_platform();
    init_telemetryUtils();
    endpointUrl = "https://mobile.events.data.microsoft.com/OneCollector/1.0";
    endpointHealthUrl = "https://mobile.events.data.microsoft.com/ping";
    $KY = class {
      constructor(e, f, g, iKeyOrClientFactory, h) {
        this.e = e;
        this.f = f;
        this.g = g;
        this.h = h;
        this.c = endpointUrl;
        this.d = endpointHealthUrl;
        if (!this.g) {
          this.g = {};
        }
        if (typeof iKeyOrClientFactory === "function") {
          this.a = iKeyOrClientFactory();
        } else {
          this.a = iKeyOrClientFactory;
        }
        this.b = null;
      }
      i(callback) {
        if (!this.a) {
          return;
        }
        if (typeof this.a !== "string") {
          callback(this.a);
          return;
        }
        if (!this.b) {
          this.b = getClient(this.a, this.e, this.h);
        }
        this.b.then((aiClient) => {
          callback(aiClient);
        }, (err) => {
          $gb(err);
          console.error(err);
        });
      }
      log(eventName, data) {
        if (!this.a) {
          return;
        }
        data = $Ov(data, this.g);
        data = $lw(data);
        const name = this.f + "/" + eventName;
        try {
          this.i((aiClient) => {
            aiClient.pluginVersionString = data?.properties.version ?? "Unknown";
            aiClient.track({
              name,
              baseData: { name, properties: data?.properties, measurements: data?.measurements }
            });
          });
        } catch {
        }
      }
      flush() {
        if (this.a) {
          return new Promise((resolve4) => {
            this.i((aiClient) => {
              aiClient.unload(true, () => {
                this.a = void 0;
                resolve4(void 0);
              });
            });
          });
        }
        return Promise.resolve(void 0);
      }
    };
  }
});

// out-build/vs/platform/telemetry/node/1dsAppender.js
import * as https from "https";
async function makeTelemetryRequest(options2, requestService) {
  const response = await requestService.request(options2, CancellationToken.None);
  const responseData = (await $Oi(response.stream)).toString();
  const statusCode = response.res.statusCode ?? 200;
  const headers = response.res.headers;
  return {
    headers,
    statusCode,
    responseData
  };
}
async function makeLegacyTelemetryRequest(options2) {
  const httpsOptions = {
    method: options2.type,
    headers: options2.headers
  };
  const responsePromise = new Promise((resolve4, reject) => {
    const req = https.request(options2.url ?? "", httpsOptions, (res) => {
      res.on("data", function(responseData) {
        resolve4({
          headers: res.headers,
          statusCode: res.statusCode ?? 200,
          responseData: responseData.toString()
        });
      });
      res.on("error", function(err) {
        reject(err);
      });
    });
    req.write(options2.data, (err) => {
      if (err) {
        reject(err);
      }
    });
    req.end();
  });
  return responsePromise;
}
async function sendPostAsync(requestService, payload, oncomplete) {
  const telemetryRequestData = typeof payload.data === "string" ? payload.data : new TextDecoder().decode(payload.data);
  const requestOptions = {
    type: "POST",
    headers: {
      ...payload.headers,
      "Content-Type": "application/json",
      "Content-Length": Buffer.byteLength(payload.data).toString()
    },
    url: payload.urlString,
    data: telemetryRequestData
  };
  try {
    const responseData = requestService ? await makeTelemetryRequest(requestOptions, requestService) : await makeLegacyTelemetryRequest(requestOptions);
    oncomplete(responseData.statusCode, responseData.headers, responseData.responseData);
  } catch {
    oncomplete(0, {});
  }
}
var $LY;
var init_dsAppender2 = __esm({
  "out-build/vs/platform/telemetry/node/1dsAppender.js"() {
    "use strict";
    init_buffer();
    init_cancellation();
    init_dsAppender();
    $LY = class extends $KY {
      constructor(requestService, isInternalTelemetry, eventPrefix2, defaultData, iKeyOrClientFactory) {
        const customHttpXHROverride = {
          sendPOST: (payload, oncomplete) => {
            sendPostAsync(requestService, payload, oncomplete);
          }
        };
        super(isInternalTelemetry, eventPrefix2, defaultData, iKeyOrClientFactory, customHttpXHROverride);
      }
    };
  }
});

// out-build/vs/workbench/services/extensions/common/extensionsUtil.js
function $MY(system, user, workspace, development, logService) {
  const result = new $7z();
  system.forEach((systemExtension) => {
    const extension = result.get(systemExtension.identifier);
    if (extension) {
      logService.warn(localize(12891, null, extension.extensionLocation.fsPath, systemExtension.extensionLocation.fsPath));
    }
    result.set(systemExtension.identifier, systemExtension);
  });
  user.forEach((userExtension) => {
    const extension = result.get(userExtension.identifier);
    if (extension) {
      if (extension.isBuiltin) {
        if (gte(extension.version, userExtension.version)) {
          logService.warn(`Skipping extension ${userExtension.extensionLocation.path} in favour of the builtin extension ${extension.extensionLocation.path}.`);
          return;
        }
        userExtension.isBuiltin = true;
      } else {
        logService.warn(localize(12892, null, extension.extensionLocation.fsPath, userExtension.extensionLocation.fsPath));
      }
    } else if (userExtension.isBuiltin) {
      logService.warn(`Skipping obsolete builtin extension ${userExtension.extensionLocation.path}`);
      return;
    }
    result.set(userExtension.identifier, userExtension);
  });
  workspace.forEach((workspaceExtension) => {
    const extension = result.get(workspaceExtension.identifier);
    if (extension) {
      logService.warn(localize(12893, null, extension.extensionLocation.fsPath, workspaceExtension.extensionLocation.fsPath));
    }
    result.set(workspaceExtension.identifier, workspaceExtension);
  });
  development.forEach((developedExtension) => {
    logService.info(localize(12894, null, developedExtension.extensionLocation.fsPath));
    const extension = result.get(developedExtension.identifier);
    if (extension) {
      if (extension.isBuiltin) {
        developedExtension.isBuiltin = true;
      }
    }
    result.set(developedExtension.identifier, developedExtension);
  });
  return Array.from(result.values());
}
var init_extensionsUtil = __esm({
  "out-build/vs/workbench/services/extensions/common/extensionsUtil.js"() {
    "use strict";
    init_extensions();
    init_nls2();
    init_semver();
  }
});

// out-build/vs/server/node/remoteExtensionsScanner.js
var $PY, $QY;
var init_remoteExtensionsScanner = __esm({
  "out-build/vs/server/node/remoteExtensionsScanner.js"() {
    "use strict";
    init_path();
    init_platform();
    init_process();
    init_uri();
    init_performance();
    init_uriIpc();
    init_contextkey();
    init_extensionsScannerService();
    init_extensionsUtil();
    init_network();
    $PY = class {
      constructor(c, environmentService, d, f, g, h, i) {
        this.c = c;
        this.d = d;
        this.f = f;
        this.g = g;
        this.h = h;
        this.i = i;
        this.a = Promise.resolve();
        this.b = Promise.resolve();
        const builtinExtensionsToInstall = environmentService.args["install-builtin-extension"];
        if (builtinExtensionsToInstall) {
          g.trace("Installing builtin extensions passed via args...");
          const installOptions = { isMachineScoped: !!environmentService.args["do-not-sync"], installPreReleaseVersion: !!environmentService.args["pre-release"] };
          $S("code/server/willInstallBuiltinExtensions");
          this.b = this.a = c.installExtensions([], this.j(builtinExtensionsToInstall), installOptions, !!environmentService.args["force"]).then(() => {
            $S("code/server/didInstallBuiltinExtensions");
            g.trace("Finished installing builtin extensions");
          }, (error) => {
            g.error(error);
          });
        }
        const extensionsToInstall = environmentService.args["install-extension"];
        if (extensionsToInstall) {
          g.trace("Installing extensions passed via args...");
          this.b = this.a.then(() => c.installExtensions(this.j(extensionsToInstall), [], {
            isMachineScoped: !!environmentService.args["do-not-sync"],
            installPreReleaseVersion: !!environmentService.args["pre-release"],
            isApplicationScoped: true
            // extensions installed during server startup are available to all profiles
          }, !!environmentService.args["force"])).then(() => {
            g.trace("Finished installing extensions");
          }, (error) => {
            g.error(error);
          });
        }
      }
      j(inputs) {
        return inputs.map((input) => /\.vsix$/i.test(input) ? URI.file($mc(input) ? input : $nc(cwd(), input)) : input);
      }
      whenExtensionsReady() {
        return this.b;
      }
      async scanExtensions(language, profileLocation, workspaceExtensionLocations, extensionDevelopmentLocations, languagePackId) {
        $S("code/server/willScanExtensions");
        this.g.trace(`Scanning extensions using UI language: ${language}`);
        await this.a;
        const extensionDevelopmentPaths = extensionDevelopmentLocations ? extensionDevelopmentLocations.filter((url3) => url3.scheme === Schemas.file).map((url3) => url3.fsPath) : void 0;
        profileLocation = profileLocation ?? this.d.defaultProfile.extensionsResource;
        const extensions = await this.k(profileLocation, language ?? $z, workspaceExtensionLocations, extensionDevelopmentPaths, languagePackId);
        this.g.trace("Scanned Extensions", extensions);
        this.r(extensions);
        $S("code/server/didScanExtensions");
        return extensions;
      }
      async k(profileLocation, language, workspaceInstalledExtensionLocations, extensionDevelopmentPath, languagePackId) {
        await this.q(language, languagePackId);
        const [builtinExtensions, installedExtensions, workspaceInstalledExtensions, developedExtensions] = await Promise.all([
          this.n(language),
          this.o(profileLocation, language),
          this.m(language, workspaceInstalledExtensionLocations),
          this.l(language, extensionDevelopmentPath)
        ]);
        return $MY(builtinExtensions, installedExtensions, workspaceInstalledExtensions, developedExtensions, this.g);
      }
      async l(language, extensionDevelopmentPaths) {
        if (extensionDevelopmentPaths) {
          return (await Promise.all(extensionDevelopmentPaths.map((extensionDevelopmentPath) => this.f.scanOneOrMultipleExtensions(URI.file($oc(extensionDevelopmentPath)), 1, { language })))).flat().map((e) => $7A(e, true));
        }
        return [];
      }
      async m(language, workspaceInstalledExtensions) {
        const result = [];
        if (workspaceInstalledExtensions?.length) {
          const scannedExtensions = await Promise.all(workspaceInstalledExtensions.map((location2) => this.f.scanExistingExtension(location2, 1, { language })));
          for (const scannedExtension of scannedExtensions) {
            if (scannedExtension) {
              result.push($7A(scannedExtension, false));
            }
          }
        }
        return result;
      }
      async n(language) {
        const scannedExtensions = await this.f.scanSystemExtensions({ language, useCache: true });
        return scannedExtensions.map((e) => $7A(e, false));
      }
      async o(profileLocation, language) {
        const scannedExtensions = await this.f.scanUserExtensions({ profileLocation, language, useCache: true });
        return scannedExtensions.map((e) => $7A(e, false));
      }
      async q(language, languagePackId) {
        if (
          // No need to install language packs for the default language
          language === $j || // The extension gallery service needs to be available
          !this.h.isEnabled()
        ) {
          return;
        }
        try {
          const installed = await this.i.getInstalledLanguages();
          if (installed.find((p) => p.id === language)) {
            this.g.trace(`Language Pack ${language} is already installed. Skipping language pack installation.`);
            return;
          }
        } catch (err) {
          this.g.error(err);
        }
        if (!languagePackId) {
          this.g.trace(`No language pack id provided for language ${language}. Skipping language pack installation.`);
          return;
        }
        this.g.trace(`Language Pack ${languagePackId} for language ${language} is not installed. It will be installed now.`);
        try {
          await this.c.installExtensions([languagePackId], [], { isMachineScoped: true }, true);
        } catch (err) {
          this.g.error(err);
        }
      }
      r(extensions) {
        const _mapResourceSchemeValue = (value, isRegex) => {
          return value.replace(/file/g, "vscode-remote");
        };
        const _mapResourceRegExpValue = (value) => {
          let flags = "";
          flags += value.global ? "g" : "";
          flags += value.ignoreCase ? "i" : "";
          flags += value.multiline ? "m" : "";
          return new RegExp(_mapResourceSchemeValue(value.source, true), flags);
        };
        const _exprKeyMapper = new class {
          mapDefined(key) {
            return $_m.create(key);
          }
          mapNot(key) {
            return $en.create(key);
          }
          mapEquals(key, value) {
            if (key === "resourceScheme" && typeof value === "string") {
              return $an.create(key, _mapResourceSchemeValue(value, false));
            } else {
              return $an.create(key, value);
            }
          }
          mapNotEquals(key, value) {
            if (key === "resourceScheme" && typeof value === "string") {
              return $dn.create(key, _mapResourceSchemeValue(value, false));
            } else {
              return $dn.create(key, value);
            }
          }
          mapGreater(key, value) {
            return $fn.create(key, value);
          }
          mapGreaterEquals(key, value) {
            return $gn.create(key, value);
          }
          mapSmaller(key, value) {
            return $hn.create(key, value);
          }
          mapSmallerEquals(key, value) {
            return $in.create(key, value);
          }
          mapRegex(key, regexp) {
            if (key === "resourceScheme" && regexp) {
              return $jn.create(key, _mapResourceRegExpValue(regexp));
            } else {
              return $jn.create(key, regexp);
            }
          }
          mapIn(key, valueKey) {
            return $bn.create(key, valueKey);
          }
          mapNotIn(key, valueKey) {
            return $cn.create(key, valueKey);
          }
        }();
        const _massageWhenUser = (element) => {
          if (!element || !element.when || !/resourceScheme/.test(element.when)) {
            return;
          }
          const expr = $7m.deserialize(element.when);
          if (!expr) {
            return;
          }
          const massaged = expr.map(_exprKeyMapper);
          element.when = massaged.serialize();
        };
        const _massageWhenUserArr = (elements) => {
          if (Array.isArray(elements)) {
            for (const element of elements) {
              _massageWhenUser(element);
            }
          } else {
            _massageWhenUser(elements);
          }
        };
        const _massageLocWhenUser = (target) => {
          for (const loc in target) {
            _massageWhenUserArr(target[loc]);
          }
        };
        extensions.forEach((extension) => {
          if (extension.contributes) {
            if (extension.contributes.menus) {
              _massageLocWhenUser(extension.contributes.menus);
            }
            if (extension.contributes.keybindings) {
              _massageWhenUserArr(extension.contributes.keybindings);
            }
            if (extension.contributes.views) {
              _massageLocWhenUser(extension.contributes.views);
            }
          }
        });
      }
    };
    $QY = class {
      constructor(a, b) {
        this.a = a;
        this.b = b;
      }
      listen(context, event) {
        throw new Error("Invalid listen");
      }
      async call(context, command, args) {
        const uriTransformer = this.b(context);
        switch (command) {
          case "whenExtensionsReady":
            return this.a.whenExtensionsReady();
          case "scanExtensions": {
            const language = args[0];
            const profileLocation = args[1] ? URI.revive(uriTransformer.transformIncoming(args[1])) : void 0;
            const workspaceExtensionLocations = Array.isArray(args[2]) ? args[2].map((u) => URI.revive(uriTransformer.transformIncoming(u))) : void 0;
            const extensionDevelopmentPath = Array.isArray(args[3]) ? args[3].map((u) => URI.revive(uriTransformer.transformIncoming(u))) : void 0;
            const languagePackId = args[4];
            const extensions = await this.a.scanExtensions(language, profileLocation, workspaceExtensionLocations, extensionDevelopmentPath, languagePackId);
            return extensions.map((extension) => $ty(extension, uriTransformer));
          }
        }
        throw new Error("Invalid call");
      }
    };
  }
});

// out-build/vs/platform/remote/common/remoteExtensionsScanner.js
var $NY, $OY;
var init_remoteExtensionsScanner2 = __esm({
  "out-build/vs/platform/remote/common/remoteExtensionsScanner.js"() {
    "use strict";
    init_instantiation();
    $NY = $Qk("IRemoteExtensionsScannerService");
    $OY = "remoteExtensionsScanner";
  }
});

// out-build/vs/platform/userDataProfile/common/userDataProfileIpc.js
var $RY;
var init_userDataProfileIpc = __esm({
  "out-build/vs/platform/userDataProfile/common/userDataProfileIpc.js"() {
    "use strict";
    init_event();
    init_lifecycle();
    init_userDataProfile();
    init_uriIpc();
    $RY = class {
      constructor(a, b) {
        this.a = a;
        this.b = b;
      }
      listen(context, event) {
        const uriTransformer = this.b(context);
        switch (event) {
          case "onDidChangeProfiles":
            return Event.map(this.a.onDidChangeProfiles, (e) => {
              return {
                all: e.all.map((p) => $ty({ ...p }, uriTransformer)),
                added: e.added.map((p) => $ty({ ...p }, uriTransformer)),
                removed: e.removed.map((p) => $ty({ ...p }, uriTransformer)),
                updated: e.updated.map((p) => $ty({ ...p }, uriTransformer))
              };
            });
        }
        throw new Error(`Invalid listen ${event}`);
      }
      async call(context, command, args) {
        const uriTransformer = this.b(context);
        switch (command) {
          case "createProfile": {
            const profile = await this.a.createProfile(args[0], args[1], args[2]);
            return $ty({ ...profile }, uriTransformer);
          }
          case "updateProfile": {
            let profile = $ss($uy(args[0], uriTransformer), this.a.profilesHome.scheme);
            profile = await this.a.updateProfile(profile, args[1]);
            return $ty({ ...profile }, uriTransformer);
          }
          case "removeProfile": {
            const profile = $ss($uy(args[0], uriTransformer), this.a.profilesHome.scheme);
            return this.a.removeProfile(profile);
          }
        }
        throw new Error(`Invalid call ${command}`);
      }
    };
  }
});

// out-build/vs/platform/terminal/node/nodePtyHostStarter.js
var $TY;
var init_nodePtyHostStarter = __esm({
  "out-build/vs/platform/terminal/node/nodePtyHostStarter.js"() {
    "use strict";
    init_lifecycle();
    init_network();
    init_ipc_cp();
    init_environment();
    init_environmentService2();
    $TY = class $TY2 extends $3c {
      constructor(a, b) {
        super();
        this.a = a;
        this.b = b;
      }
      start() {
        const opts = {
          serverName: "Pty Host",
          args: ["--type=ptyHost", "--logsPath", this.b.logsHome.with({ scheme: Schemas.file }).fsPath],
          env: {
            VSCODE_ESM_ENTRYPOINT: "vs/platform/terminal/node/ptyHostMain",
            VSCODE_PIPE_LOGGING: "true",
            VSCODE_VERBOSE_LOGGING: "true",
            // transmit console logs from server to client,
            VSCODE_RECONNECT_GRACE_TIME: this.a.graceTime,
            VSCODE_RECONNECT_SHORT_GRACE_TIME: this.a.shortGraceTime,
            VSCODE_RECONNECT_SCROLLBACK: this.a.scrollback
          }
        };
        const ptyHostDebug = $3u(this.b.args, this.b.isBuilt);
        if (ptyHostDebug) {
          if (ptyHostDebug.break && ptyHostDebug.port) {
            opts.debugBrk = ptyHostDebug.port;
          } else if (!ptyHostDebug.break && ptyHostDebug.port) {
            opts.debug = ptyHostDebug.port;
          }
        }
        const client = new $ly($ih.asFileUri("bootstrap-fork").fsPath, opts);
        const store = new $2c();
        store.add(client);
        return {
          client,
          store,
          onDidProcessExit: client.onDidProcessExit
        };
      }
    };
    $TY = __decorate([
      __param(1, $Xk)
    ], $TY);
  }
});

// out-build/vs/platform/cssDev/node/cssDevService.js
import { spawn as spawn2 } from "child_process";
import { relative } from "path";
var $By, $Cy;
var init_cssDevService = __esm({
  "out-build/vs/platform/cssDev/node/cssDevService.js"() {
    "use strict";
    init_network();
    init_stopwatch();
    init_environment();
    init_instantiation();
    init_log();
    $By = $Qk("ICSSDevelopmentService");
    $Cy = class $Cy2 {
      constructor(b, c) {
        this.b = b;
        this.c = c;
      }
      get isEnabled() {
        return !this.b.isBuilt;
      }
      getCssModules() {
        this.a ??= this.d();
        return this.a;
      }
      async d() {
        if (!this.isEnabled) {
          return [];
        }
        const rg = await import("@vscode/ripgrep");
        return await new Promise((resolve4) => {
          const sw = $te.create();
          const chunks = [];
          const decoder = new TextDecoder();
          const basePath = $ih.asFileUri("").fsPath;
          const process2 = spawn2(rg.rgPath, ["-g", "**/*.css", "--files", "--no-ignore", basePath], {});
          process2.stdout.on("data", (data) => {
            const chunk = decoder.decode(data, { stream: true });
            chunks.push(chunk.split("\n").filter(Boolean));
          });
          process2.on("error", (err) => {
            this.c.error("[CSS_DEV] FAILED to compute CSS data", err);
            resolve4([]);
          });
          process2.on("close", () => {
            const result = chunks.flat().map((path7) => relative(basePath, path7).replace(/\\/g, "/")).filter(Boolean).sort();
            resolve4(result);
            this.c.info(`[CSS_DEV] DONE, ${result.length} css modules (${Math.round(sw.elapsed())}ms)`);
          });
        });
      }
    };
    $Cy = __decorate([
      __param(0, $Xk),
      __param(1, $wn)
    ], $Cy);
  }
});

// out-build/vs/server/node/pwbConstants.js
var $VY, $WY, $XY, $YY, $ZY, $1Y, $2Y, $3Y, $4Y, $5Y;
var init_pwbConstants = __esm({
  "out-build/vs/server/node/pwbConstants.js"() {
    "use strict";
    $VY = process.env.RS_URI_SCHEME;
    $WY = process.env.RS_SESSION_URL ?? "";
    $XY = process.env.RS_SERVER_URL?.endsWith("/") ? process.env.RS_SERVER_URL.slice(0, -1) : process.env.RS_SERVER_URL;
    $YY = process.env.RS_BASE_URL ?? "";
    $ZY = process.env["USER"] || "rstudio-server";
    $1Y = process.env.POSITRON === "1";
    $2Y = new RegExp("/proxy/[0-9]+[^a-zA-Z](/)?");
    $3Y = "/heartbeat";
    $4Y = process.env.POSITRON_IDLE_TIMEOUT ?? "0";
    $5Y = process.env.VSCODE_IDLE_TIMEOUT ?? "0";
  }
});

// out-build/vs/server/node/pwbHeartbeat.js
var $6Y, $7Y;
var init_pwbHeartbeat = __esm({
  "out-build/vs/server/node/pwbHeartbeat.js"() {
    "use strict";
    init_instantiation();
    init_extensions2();
    init_descriptors();
    init_pwbConstants();
    $6Y = $Qk("pwbHeartbeatService");
    $7Y = class {
      constructor() {
        const match = $WY.match(/\/s\/([a-f0-9]+)\//);
        this.a = match ? match[1] : "";
        const serverUrl = ($XY || $VY + ":") + $YY;
        this.b = serverUrl.endsWith("/") ? serverUrl.slice(0, -1) + $3Y : serverUrl + $3Y;
        this.c = $1Y ? "positron" : "vscode";
        const timeoutSetting = $1Y ? $4Y : $5Y;
        this.d = parseFloat(timeoutSetting) * 60;
        if (isNaN(this.d)) {
          this.d = 0;
        }
      }
      sendInitialHeartbeat() {
        const rpcCookie = process.env.RS_SESSION_RPC_COOKIE ?? "";
        if (rpcCookie === "") {
          console.log("No RPC Cookie found. Initial heartbeat request will fail.");
        }
        fetch(this.b, {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
            "X-RS-Session-Server-RPC-Cookie": rpcCookie
          },
          body: JSON.stringify({
            method: "heartbeat",
            kwparams: {
              sessionId: this.a,
              username: $ZY,
              product: this.c
            }
          })
        }).then((response) => {
          if (!response.ok) {
            return response.text().then((errorText) => {
              throw new Error(`${response.status} ${response.statusText} - ${errorText}`);
            });
          }
          return response;
        }).then(() => {
          console.log(`Initial heartbeat for ${$ZY}'s session ${this.a} successfully sent to ${this.b}`);
        }).catch((error) => {
          console.log(`Initial heartbeat for ${$ZY}'s session ${this.a} to ${this.b} failed: ` + error);
        });
      }
    };
    $SC($6Y, new $Nk($7Y));
  }
});

// out-build/vs/server/node/serverServices.js
import { hostname, release as release3 } from "os";
async function $8Y(connectionToken, args, REMOTE_DATA_FOLDER, disposables) {
  const services = new $Ok();
  const socketServer = new $9Y();
  services.set($6Y, new $7Y());
  const productService = { _serviceBrand: void 0, ...product_default };
  services.set($Vu, productService);
  const environmentService = new $QW(args, productService);
  services.set($Xk, environmentService);
  services.set($Yk, environmentService);
  const loggerService = new $gx($Kn(environmentService), environmentService.logsHome);
  services.set($xn, loggerService);
  socketServer.registerChannel("logger", new $qB(loggerService, (ctx) => getUriTransformer(ctx.remoteAuthority)));
  const logger = loggerService.createLogger("remoteagent", { name: localize(2568, null) });
  const logService = new $WC(logger, [new ServerLogger($Kn(environmentService))]);
  services.set($wn, logService);
  setTimeout(() => cleanupOlderLogs(environmentService.logsHome.with({ scheme: Schemas.file }).fsPath).then(null, (err) => logService.error(err)), 1e4);
  logService.onDidChangeLogLevel((logLevel) => log(logService, logLevel, `Log level changed to ${$Ln(logService.getLevel())}`));
  logService.trace(`Remote configuration data at ${REMOTE_DATA_FOLDER}`);
  logService.trace("process arguments:", environmentService.args);
  if (Array.isArray(productService.serverGreeting)) {
    logService.info(`

${productService.serverGreeting.join("\n")}

`);
  }
  socketServer.registerChannel($Bx.ChannelName, new $Bx());
  const router = new $nu((ctx) => ctx.clientId === "renderer");
  const fileService = disposables.add(new $7B(logService));
  services.set($km, fileService);
  fileService.registerProvider(Schemas.file, disposables.add(new $qy(logService)));
  const uriIdentityService = new $VC(fileService);
  services.set($vl, uriIdentityService);
  const configurationService = new $2B(environmentService.machineSettingsResource, fileService, new $Rn(), logService);
  services.set($kl, configurationService);
  const userDataProfilesService = new $Mw(uriIdentityService, environmentService, fileService, logService);
  services.set($rs, userDataProfilesService);
  socketServer.registerChannel("userDataProfiles", new $RY(userDataProfilesService, (ctx) => getUriTransformer(ctx.remoteAuthority)));
  services.set($By, new $Nk($Cy, void 0, true));
  const [, , machineId2, sqmId, devDeviceId] = await Promise.all([
    configurationService.initialize(),
    userDataProfilesService.init(),
    $Fy(logService.error.bind(logService)),
    $Gy(logService.error.bind(logService)),
    $Hy(logService.error.bind(logService))
  ]);
  const extensionHostStatusService = new $MW();
  services.set($LW, extensionHostStatusService);
  const requestService = new $KC(configurationService, environmentService, logService);
  services.set($9u, requestService);
  let oneDsAppender = $hw;
  const isInternal = $nw(productService, configurationService);
  if ($iw(productService, environmentService)) {
    if (!$jw(productService, environmentService) && productService.aiConfig?.ariaKey) {
      oneDsAppender = new $LY(requestService, isInternal, eventPrefix, null, productService.aiConfig.ariaKey);
      disposables.add($1c(() => oneDsAppender?.flush()));
    }
    const config = {
      appenders: [oneDsAppender],
      commonProperties: $_v(release3(), hostname(), process.arch, productService.commit, productService.version + "-remote", machineId2, sqmId, devDeviceId, isInternal, "remoteAgent"),
      piiPaths: $ow(environmentService)
    };
    const initialTelemetryLevelArg = environmentService.args["telemetry-level"];
    let injectedTelemetryLevel = 3;
    if (initialTelemetryLevelArg === "all") {
      injectedTelemetryLevel = 3;
    } else if (initialTelemetryLevelArg === "error") {
      injectedTelemetryLevel = 2;
    } else if (initialTelemetryLevelArg === "crash") {
      injectedTelemetryLevel = 1;
    } else if (initialTelemetryLevelArg !== void 0) {
      injectedTelemetryLevel = 0;
    }
    services.set($LX, new $Nk($JX, [config, injectedTelemetryLevel]));
  } else {
    services.set($LX, $KX);
  }
  services.set($pA, new $Nk($$W));
  const downloadChannel = socketServer.getChannel("download", router);
  services.set($6W, new $8W(
    downloadChannel,
    () => getUriTransformer("renderer")
    /* TODO: @Sandy @Joao need dynamic context based router */
  ));
  services.set($QA, new $Nk($jB));
  services.set($4A, new $Nk($JY));
  services.set($_W, new $Nk($aX));
  services.set($xA, new $Nk($UY));
  services.set($uX, new $Nk($vX));
  const instantiationService = new $0B(services);
  services.set($yX, instantiationService.createInstance($AX));
  const ptyHostStarter = instantiationService.createInstance($TY, {
    graceTime: 108e5,
    shortGraceTime: 3e5,
    scrollback: configurationService.getValue(
      "terminal.integrated.persistentSessionScrollback"
      /* TerminalSettingId.PersistentSessionScrollback */
    ) ?? 100
  });
  const ptyHostService = instantiationService.createInstance($MB, ptyHostStarter);
  services.set($5x, ptyHostService);
  instantiationService.invokeFunction((accessor) => {
    const extensionManagementService = accessor.get($uX);
    const extensionsScannerService = accessor.get($4A);
    const extensionGalleryService = accessor.get($pA);
    const languagePackService = accessor.get($yX);
    const remoteExtensionEnvironmentChannel = new $HX(connectionToken, environmentService, userDataProfilesService, extensionHostStatusService);
    socketServer.registerChannel("remoteextensionsenvironment", remoteExtensionEnvironmentChannel);
    const telemetryChannel = new $MX(accessor.get($LX), oneDsAppender);
    socketServer.registerChannel("telemetry", telemetryChannel);
    socketServer.registerChannel($FY, new $EY(environmentService, logService, ptyHostService, productService, extensionManagementService, configurationService));
    const remoteExtensionsScanner = new $PY(instantiationService.createInstance($bX, logService), environmentService, userDataProfilesService, extensionsScannerService, logService, extensionGalleryService, languagePackService);
    socketServer.registerChannel($OY, new $QY(remoteExtensionsScanner, (ctx) => getUriTransformer(ctx.remoteAuthority)));
    const remoteFileSystemChannel = disposables.add(new $IX(logService, environmentService, configurationService));
    socketServer.registerChannel($HY, remoteFileSystemChannel);
    socketServer.registerChannel("request", new $BX(accessor.get($9u)));
    const channel = new $gX(extensionManagementService, (ctx) => getUriTransformer(ctx.remoteAuthority));
    socketServer.registerChannel("extensions", channel);
    remoteExtensionsScanner.whenExtensionsReady().then(() => extensionManagementService.cleanUp());
    disposables.add(new $EX(accessor.get($zv)));
    return {
      telemetryService: accessor.get($zv)
    };
  });
  return { socketServer, instantiationService };
}
function getUriTransformer(remoteAuthority) {
  if (!_uriTransformerCache[remoteAuthority]) {
    _uriTransformerCache[remoteAuthority] = $FX(remoteAuthority);
  }
  return _uriTransformerCache[remoteAuthority];
}
function now() {
  const date = /* @__PURE__ */ new Date();
  return `${twodigits(date.getHours())}:${twodigits(date.getMinutes())}:${twodigits(date.getSeconds())}`;
}
function twodigits(n) {
  if (n < 10) {
    return `0${n}`;
  }
  return String(n);
}
async function cleanupOlderLogs(logsPath) {
  const currentLog = $rc(logsPath);
  const logsRoot = $qc(logsPath);
  const children = await Promises2.readdir(logsRoot);
  const allSessions = children.filter((name) => /^\d{8}T\d{6}$/.test(name));
  const oldSessions = allSessions.sort().filter((d) => d !== currentLog);
  const toDelete = oldSessions.slice(0, Math.max(0, oldSessions.length - 9));
  await Promise.all(toDelete.map((name) => Promises2.rm($nc(logsRoot, name))));
}
var eventPrefix, _uriTransformerCache, $9Y, ServerLogger;
var init_serverServices = __esm({
  "out-build/vs/server/node/serverServices.js"() {
    "use strict";
    init_event();
    init_lifecycle();
    init_network();
    init_path();
    init_id();
    init_pfs();
    init_ipc();
    init_configuration();
    init_configurationService();
    init_extensionHostDebugIpc();
    init_download();
    init_downloadIpc();
    init_environment();
    init_extensionGalleryService();
    init_extensionManagement();
    init_extensionSignatureVerificationService();
    init_extensionManagementCLI();
    init_extensionManagementIpc();
    init_extensionManagementService();
    init_files();
    init_fileService();
    init_diskFileSystemProvider2();
    init_descriptors();
    init_instantiationService();
    init_serviceCollection();
    init_languagePacks();
    init_languagePacks2();
    init_log();
    init_product();
    init_productService();
    init_request();
    init_requestIpc();
    init_requestService();
    init_commonProperties();
    init_telemetry();
    init_telemetryUtils();
    init_errorTelemetry2();
    init_terminal();
    init_ptyHostService();
    init_uriIdentity();
    init_uriIdentityService();
    init_remoteAgentEnvironmentImpl();
    init_remoteFileSystemProviderServer();
    init_remoteTelemetryChannel();
    init_serverTelemetryService();
    init_remoteTerminalChannel();
    init_uriTransformer();
    init_serverEnvironmentService();
    init_remoteTerminalChannel2();
    init_remoteFileSystemProviderClient();
    init_extensionHostStatusService();
    init_extensionsScannerService();
    init_extensionsScannerService2();
    init_extensionsProfileScannerService();
    init_userDataProfile();
    init_policy();
    init_dsAppender2();
    init_loggerService();
    init_userDataProfile2();
    init_extensionsProfileScannerService2();
    init_logService();
    init_logIpc();
    init_nls2();
    init_remoteExtensionsScanner();
    init_remoteExtensionsScanner2();
    init_userDataProfileIpc();
    init_nodePtyHostStarter();
    init_cssDevService();
    init_allowedExtensionsService();
    init_pwbHeartbeat();
    eventPrefix = "monacoworkbench";
    _uriTransformerCache = /* @__PURE__ */ Object.create(null);
    $9Y = class extends $ju {
      constructor() {
        const emitter = new $ze();
        super(emitter.event);
        this.b = emitter;
      }
      acceptConnection(protocol, onDidClientDisconnect) {
        this.b.fire({ protocol, onDidClientDisconnect });
      }
    };
    ServerLogger = class extends $Bn {
      constructor(logLevel = $zn) {
        super();
        this.setLevel(logLevel);
        this.h = Boolean(process.stdout.isTTY);
      }
      trace(message, ...args) {
        if (this.g(LogLevel.Trace)) {
          if (this.h) {
            console.log(`\x1B[90m[${now()}]\x1B[0m`, message, ...args);
          } else {
            console.log(`[${now()}]`, message, ...args);
          }
        }
      }
      debug(message, ...args) {
        if (this.g(LogLevel.Debug)) {
          if (this.h) {
            console.log(`\x1B[90m[${now()}]\x1B[0m`, message, ...args);
          } else {
            console.log(`[${now()}]`, message, ...args);
          }
        }
      }
      info(message, ...args) {
        if (this.g(LogLevel.Info)) {
          if (this.h) {
            console.log(`\x1B[90m[${now()}]\x1B[0m`, message, ...args);
          } else {
            console.log(`[${now()}]`, message, ...args);
          }
        }
      }
      warn(message, ...args) {
        if (this.g(LogLevel.Warning)) {
          if (this.h) {
            console.warn(`\x1B[93m[${now()}]\x1B[0m`, message, ...args);
          } else {
            console.warn(`[${now()}]`, message, ...args);
          }
        }
      }
      error(message, ...args) {
        if (this.g(LogLevel.Error)) {
          if (this.h) {
            console.error(`\x1B[91m[${now()}]\x1B[0m`, message, ...args);
          } else {
            console.error(`[${now()}]`, message, ...args);
          }
        }
      }
      flush() {
      }
    };
  }
});

// out-build/vs/server/node/webClientServer.js
import { createReadStream, promises as promises14 } from "fs";
import * as path5 from "path";
import * as url from "url";
import * as cookie2 from "cookie";
import * as crypto2 from "crypto";
import httpProxy from "http-proxy";
async function $0Y(req, res, errorCode, errorMessage) {
  res.writeHead(errorCode, { "Content-Type": "text/plain" });
  res.end(errorMessage);
}
async function $$Y(filePath, cacheControl, logService, req, res, responseHeaders) {
  try {
    const stat = await promises14.stat(filePath);
    if (cacheControl === 1) {
      const etag = `W/"${[stat.ino, stat.size, stat.mtime.getTime()].join("-")}"`;
      if (req.headers["if-none-match"] === etag) {
        res.writeHead(304);
        return void res.end();
      }
      responseHeaders["Etag"] = etag;
    } else if (cacheControl === 2) {
      responseHeaders["Cache-Control"] = "public, max-age=31536000";
    } else if (cacheControl === 0) {
      responseHeaders["Cache-Control"] = "no-store";
    }
    responseHeaders["Content-Type"] = textMimeType[$sc(filePath)] || $1C(filePath) || "text/plain";
    res.writeHead(200, responseHeaders);
    createReadStream(filePath).pipe(res);
  } catch (error) {
    if (error.code !== "ENOENT") {
      logService.error(error);
      console.error(error.toString());
    } else {
      console.error(`File not found: ${filePath}`);
    }
    res.writeHead(404, { "Content-Type": "text/plain" });
    return void res.end("Not found");
  }
}
var textMimeType, CacheControl, APP_ROOT, $_Y, $aZ, $bZ, $cZ;
var init_webClientServer = __esm({
  "out-build/vs/server/node/webClientServer.js"() {
    "use strict";
    init_extpath();
    init_mime();
    init_platform();
    init_log();
    init_serverEnvironmentService();
    init_path();
    init_network();
    init_uuid();
    init_productService();
    init_request();
    init_cancellation();
    init_uri();
    init_buffer();
    init_types();
    init_cssDevService();
    init_pwbConstants();
    textMimeType = {
      ".html": "text/html",
      ".js": "text/javascript",
      ".json": "application/json",
      ".css": "text/css",
      ".svg": "image/svg+xml"
    };
    (function(CacheControl2) {
      CacheControl2[CacheControl2["NO_CACHING"] = 0] = "NO_CACHING";
      CacheControl2[CacheControl2["ETAG"] = 1] = "ETAG";
      CacheControl2[CacheControl2["NO_EXPIRY"] = 2] = "NO_EXPIRY";
    })(CacheControl || (CacheControl = {}));
    APP_ROOT = $qc($ih.asFileUri("").fsPath);
    $_Y = class $_Y2 {
      // --- End PWB ---
      constructor(g, h, serverRootPath, i, j, k, l, m) {
        this.g = g;
        this.h = h;
        this.serverRootPath = serverRootPath;
        this.i = i;
        this.j = j;
        this.k = k;
        this.l = l;
        this.m = m;
        this.a = this.l.extensionsGallery?.resourceUrlTemplate ? URI.parse(this.l.extensionsGallery.resourceUrlTemplate) : void 0;
        this.b = `${serverRootPath}/static`;
        this.c = `${serverRootPath}/callback`;
        this.d = `/web-extension-resource`;
        this.f = httpProxy.createProxyServer({});
        this.f.on("proxyRes", (res, req) => {
          const base = req.url?.split("/").slice(0, 3).join("/");
          if (res.headers.location && res.headers.location.startsWith("/") && base) {
            res.headers.location = base + res.headers.location;
          }
        });
        this.f.on("error", (err, req, res) => {
          const message = `Could not proxy ${req.method} request to ${req.url}: ${err.message}`;
          console.error(message);
          res.end(message);
        });
      }
      /**
       * Handle web resources (i.e. only needed by the web client).
       * **NOTE**: This method is only invoked when the server has web bits.
       * **NOTE**: This method is only invoked after the connection token has been validated.
       */
      async handle(req, res, parsedUrl) {
        try {
          const pathname = parsedUrl.pathname;
          if (pathname.startsWith(this.b) && pathname.charCodeAt(this.b.length) === 47) {
            return this.n(req, res, parsedUrl);
          }
          if (pathname === this.h) {
            return this.q(req, res, parsedUrl);
          }
          if (pathname === this.c) {
            return this.s(res);
          }
          if ($2Y.test(pathname)) {
            let path7 = pathname.replace("/proxy/", "http://0.0.0.0:");
            if (parsedUrl.search) {
              path7 = path7.concat(parsedUrl.search);
            }
            return this.f.web(req, res, {
              ignorePath: true,
              target: path7
            });
          }
          if (pathname.startsWith(this.d) && pathname.charCodeAt(this.d.length) === 47) {
            return this.p(req, res, parsedUrl);
          }
          return $0Y(req, res, 404, "Not found.");
        } catch (error) {
          this.j.error(error);
          console.error(error.toString());
          return $0Y(req, res, 500, "Internal Server Error.");
        }
      }
      // PWB Start: Proxy server websocket support
      /**
       * Handle proxy requests for websockets
       */
      async handleUpgrade(req, socket, upgradeHead, parsedUrl) {
        const path7 = parsedUrl.replace("/proxy/", "http://0.0.0.0:");
        return this.f.ws(req, socket, upgradeHead, {
          ignorePath: true,
          target: path7
        });
      }
      // PWB End
      /**
       * Handle HTTP requests for /static/*
       */
      async n(req, res, parsedUrl) {
        const headers = /* @__PURE__ */ Object.create(null);
        const normalizedPathname = decodeURIComponent(parsedUrl.pathname);
        const relativeFilePath = normalizedPathname.substring(this.b.length + 1);
        const filePath = $nc(APP_ROOT, relativeFilePath);
        if (!$Zg(filePath, APP_ROOT, !$n)) {
          return $0Y(req, res, 400, `Bad request.`);
        }
        return $$Y(filePath, this.i.isBuilt ? 2 : 1, this.j, req, res, headers);
      }
      o(uri) {
        const index = uri.authority.indexOf(".");
        return index !== -1 ? uri.authority.substring(index + 1) : void 0;
      }
      /**
       * Handle extension resources
       */
      async p(req, res, parsedUrl) {
        if (!this.a) {
          return $0Y(req, res, 500, "No extension gallery service configured.");
        }
        const normalizedPathname = decodeURIComponent(parsedUrl.pathname);
        const path7 = $lc(normalizedPathname.substring(this.d.length + 1));
        const uri = URI.parse(path7).with({
          scheme: this.a.scheme,
          authority: path7.substring(0, path7.indexOf("/")),
          path: path7.substring(path7.indexOf("/") + 1)
        });
        if (this.o(this.a) !== this.o(uri)) {
          return $0Y(req, res, 403, "Request Forbidden");
        }
        const headers = {};
        const setRequestHeader = (header) => {
          const value = req.headers[header];
          if (value && ($zg(value) || value[0])) {
            headers[header] = $zg(value) ? value : value[0];
          } else if (header !== header.toLowerCase()) {
            setRequestHeader(header.toLowerCase());
          }
        };
        setRequestHeader("X-Client-Name");
        setRequestHeader("X-Client-Version");
        setRequestHeader("X-Machine-Id");
        setRequestHeader("X-Client-Commit");
        const context = await this.k.request({
          type: "GET",
          url: uri.toString(true),
          headers
        }, CancellationToken.None);
        const status = context.res.statusCode || 500;
        if (status !== 200) {
          let text = null;
          try {
            text = await $bv(context);
          } catch (error) {
          }
          return $0Y(req, res, status, text || `Request failed with status ${status}`);
        }
        const responseHeaders = /* @__PURE__ */ Object.create(null);
        const setResponseHeader = (header) => {
          const value = context.res.headers[header];
          if (value) {
            responseHeaders[header] = value;
          } else if (header !== header.toLowerCase()) {
            setResponseHeader(header.toLowerCase());
          }
        };
        setResponseHeader("Cache-Control");
        setResponseHeader("Content-Type");
        res.writeHead(200, responseHeaders);
        const buffer = await $Oi(context.stream);
        return void res.end(buffer.buffer);
      }
      /**
       * Handle HTTP requests for /
       */
      async q(req, res, parsedUrl) {
        const queryConnectionToken = parsedUrl.query[$ah];
        if (typeof queryConnectionToken === "string") {
          const responseHeaders = /* @__PURE__ */ Object.create(null);
          responseHeaders["Set-Cookie"] = cookie2.serialize($_g, queryConnectionToken, {
            sameSite: "lax",
            maxAge: 60 * 60 * 24 * 7
            /* 1 week */
          });
          const newQuery = /* @__PURE__ */ Object.create(null);
          for (const key in parsedUrl.query) {
            if (key !== $ah) {
              newQuery[key] = parsedUrl.query[key];
            }
          }
          const newLocation = url.format({ pathname: parsedUrl.pathname, query: newQuery });
          responseHeaders["Location"] = newLocation;
          res.writeHead(302, responseHeaders);
          return void res.end();
        }
        const remoteAuthority = "remote";
        const useTestResolver = !this.i.isBuilt && this.i.args["use-test-resolver"];
        function asJSON(value) {
          return JSON.stringify(value).replace(/"/g, "&quot;");
        }
        let _wrapWebWorkerExtHostInIframe = void 0;
        if (this.i.args["enable-smoke-test-driver"]) {
          _wrapWebWorkerExtHostInIframe = false;
        }
        const resolveWorkspaceURI = (defaultLocation) => defaultLocation && URI.file(path5.resolve(defaultLocation)).with({ scheme: Schemas.vscodeRemote, authority: remoteAuthority });
        const filePath = $ih.asFileUri(`vs/code/browser/workbench/workbench${this.i.isBuilt ? "" : "-dev"}.html`).fsPath;
        const authSessionInfo = !this.i.isBuilt && this.i.args["github-auth"] ? {
          id: $ps(),
          providerId: "github",
          accessToken: this.i.args["github-auth"],
          scopes: [["user:email"], ["repo"]]
        } : void 0;
        const base = $bZ(req.url);
        const vscodeBase = $cZ(req.url);
        const productConfiguration = {
          embedderIdentifier: "server-distro",
          // --- Start PWB: web prefix, proxy port url, custom extensions gallery ---
          rootEndpoint: base,
          proxyEndpointTemplate: base + `/p/{{port}}/${process.env.RS_PORT_TOKEN}`,
          extensionsGallery: this.l.extensionsGallery
          // --- End PWB ---
        };
        if (!this.i.isBuilt) {
          try {
            const productOverrides = JSON.parse((await promises14.readFile($nc(APP_ROOT, "product.overrides.json"))).toString());
            Object.assign(productConfiguration, productOverrides);
          } catch (err) {
          }
        }
        const workbenchWebConfiguration = {
          remoteAuthority,
          serverBasePath: this.h,
          // --- Start PWB: Local storage ---
          userDataPath: this.i.userDataPath,
          // --- End PWB ---
          // --- Start PWB: disable file downloads ---
          isEnabledFileDownloads: !this.i.args["disable-file-downloads"],
          isEnabledFileUploads: !this.i.args["disable-file-uploads"],
          // --- End PWB ---
          // --- Start PWB: serve same origin ---
          webviewEndpoint: vscodeBase + this.b + "/out/vs/workbench/contrib/webview/browser/pre",
          // --- End PWB: serve same origin ---
          _wrapWebWorkerExtHostInIframe,
          developmentOptions: { enableSmokeTestDriver: this.i.args["enable-smoke-test-driver"] ? true : void 0, logLevel: this.j.getLevel() },
          settingsSyncOptions: !this.i.isBuilt && this.i.args["enable-sync"] ? { enabled: true } : void 0,
          enableWorkspaceTrust: !this.i.args["disable-workspace-trust"],
          folderUri: resolveWorkspaceURI(this.i.args["default-folder"]),
          workspaceUri: resolveWorkspaceURI(this.i.args["default-workspace"]),
          productConfiguration,
          callbackRoute: this.c
        };
        const cookies = cookie2.parse(req.headers.cookie || "");
        const locale = cookies["vscode.nls.locale"] || req.headers["accept-language"]?.split(",")[0]?.toLowerCase() || "en";
        let WORKBENCH_NLS_BASE_URL;
        let WORKBENCH_NLS_URL;
        if (!locale.startsWith("en") && this.l.nlsCoreBaseUrl) {
          WORKBENCH_NLS_BASE_URL = this.l.nlsCoreBaseUrl;
          WORKBENCH_NLS_URL = `${WORKBENCH_NLS_BASE_URL}${this.l.commit}/${this.l.version}/${locale}/nls.messages.js`;
        } else {
          WORKBENCH_NLS_URL = "";
        }
        const values = {
          WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
          WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : "",
          // --- Start PWB ---
          // WORKBENCH_WEB_BASE_URL: this._staticRoute,
          WORKBENCH_WEB_BASE_URL: vscodeBase + this.b,
          WORKBENCH_NLS_BASE_URL: WORKBENCH_NLS_BASE_URL ?? "",
          WORKBENCH_NLS_URL,
          WORKBENCH_NLS_FALLBACK_URL: `${vscodeBase}${this.b}/out/nls.messages.js`,
          BASE: base,
          VS_BASE: vscodeBase
          // --- End PWB ---
        };
        if (this.m.isEnabled) {
          const cssModules = await this.m.getCssModules();
          values["WORKBENCH_DEV_CSS_MODULES"] = JSON.stringify(cssModules);
        }
        if (useTestResolver) {
          const bundledExtensions = [];
          for (const extensionPath of ["vscode-test-resolver", "github-authentication"]) {
            const packageJSON = JSON.parse((await promises14.readFile($ih.asFileUri(`${$dh}/${extensionPath}/package.json`).fsPath)).toString());
            bundledExtensions.push({ extensionPath, packageJSON });
          }
          values["WORKBENCH_BUILTIN_EXTENSIONS"] = asJSON(bundledExtensions);
        }
        let data;
        try {
          const workbenchTemplate = (await promises14.readFile(filePath)).toString();
          data = workbenchTemplate.replace(/\{\{([^}]+)\}\}/g, (_, key) => values[key] ?? "undefined");
        } catch (e) {
          res.writeHead(404, { "Content-Type": "text/plain" });
          return void res.end("Not found");
        }
        const webWorkerExtensionHostIframeScriptSHA = "sha256-2Q+j4hfT09+1+imS46J2YlkCtHWQt0/BE79PXjJ0ZJ8=";
        const cspDirectives = [
          "default-src 'self';",
          "img-src 'self' https: data: blob:;",
          "media-src 'self';",
          `script-src 'self' 'unsafe-eval' ${WORKBENCH_NLS_BASE_URL ?? ""} blob: 'nonce-1nline-m4p' ${this.r(data).join(" ")} '${webWorkerExtensionHostIframeScriptSHA}' 'sha256-/r7rqQ+yrxt57sxLuQ6AMYcy/lUpvAIzHjIJt/OeLWU=' ${useTestResolver ? "" : `http://${remoteAuthority}`};`,
          // the sha is the same as in src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
          "child-src 'self';",
          `frame-src 'self' https://*.vscode-cdn.net data:;`,
          "worker-src 'self' data: blob:;",
          "style-src 'self' 'unsafe-inline';",
          "connect-src 'self' ws: wss: https:;",
          "font-src 'self' blob:;",
          "manifest-src 'self';"
        ].join(" ");
        const headers = {
          "Content-Type": "text/html",
          "Content-Security-Policy": cspDirectives
        };
        if (this.g.type !== 0) {
          headers["Set-Cookie"] = cookie2.serialize($_g, this.g.value, {
            sameSite: "lax",
            maxAge: 60 * 60 * 24 * 7
            /* 1 week */
          });
        }
        res.writeHead(200, headers);
        return void res.end(data);
      }
      r(content) {
        const regex = /<script>([\s\S]+?)<\/script>/img;
        const result = [];
        let match;
        while (match = regex.exec(content)) {
          const hasher = crypto2.createHash("sha256");
          const script = match[1].replace(/\r\n/g, "\n");
          const hash = hasher.update(Buffer.from(script)).digest().toString("base64");
          result.push(`'sha256-${hash}'`);
        }
        return result;
      }
      /**
       * Handle HTTP requests for /callback
       */
      async s(res) {
        const filePath = $ih.asFileUri("vs/code/browser/workbench/callback.html").fsPath;
        const data = (await promises14.readFile(filePath)).toString();
        const cspDirectives = [
          "default-src 'self';",
          "img-src 'self' https: data: blob:;",
          "media-src 'none';",
          `script-src 'self' ${this.r(data).join(" ")};`,
          "style-src 'self' 'unsafe-inline';",
          "font-src 'self' blob:;"
        ].join(" ");
        res.writeHead(200, {
          "Content-Type": "text/html",
          "Content-Security-Policy": cspDirectives
        });
        return void res.end(data);
      }
    };
    $_Y = __decorate([
      __param(3, $PW),
      __param(4, $wn),
      __param(5, $9u),
      __param(6, $Vu),
      __param(7, $By)
    ], $_Y);
    $aZ = (url3, keepTrailing = false) => {
      return url3.replace(/\/\/+/g, "/").replace(/\/+$/, keepTrailing ? "/" : "");
    };
    $bZ = (originalUrl) => {
      const depth = (originalUrl.split("?", 1)[0].match(/\//g) || []).length;
      return $aZ("./" + (depth > 1 ? "../".repeat(depth - 1) : ""));
    };
    $cZ = (originalUrl) => {
      const parts = originalUrl.split("?", 1)[0].split("/");
      return $aZ("./" + parts[parts.length - 1]);
    };
  }
});

// out-build/vs/server/node/remoteExtensionHostAgentServer.js
import * as crypto3 from "crypto";
import * as fs12 from "fs";
import * as net3 from "net";
import { performance as performance2 } from "perf_hooks";
import * as url2 from "url";
import { createRequire as createRequire4 } from "node:module";
async function $dZ(address, args, REMOTE_DATA_FOLDER) {
  const connectionToken = await $4W(args);
  if (connectionToken instanceof $2W) {
    console.warn(connectionToken.message);
    process.exit(1);
  }
  function initUnexpectedErrorHandler(handler) {
    setUnexpectedErrorHandler((err) => {
      if ($eb(err) && err.stack && /unexpectedErrorHandler/.test(err.stack)) {
        return;
      }
      handler(err);
    });
  }
  const unloggedErrors = [];
  initUnexpectedErrorHandler((error) => {
    unloggedErrors.push(error);
    console.error(error);
  });
  let didLogAboutSIGPIPE = false;
  process.on("SIGPIPE", () => {
    if (!didLogAboutSIGPIPE) {
      didLogAboutSIGPIPE = true;
      $gb(new Error(`Unexpected SIGPIPE`));
    }
  });
  const disposables = new $2c();
  const { socketServer, instantiationService } = await $8Y(connectionToken, args, REMOTE_DATA_FOLDER, disposables);
  instantiationService.invokeFunction((accessor) => {
    const logService = accessor.get($wn);
    unloggedErrors.forEach((error) => logService.error(error));
    unloggedErrors.length = 0;
    initUnexpectedErrorHandler((error) => logService.error(error));
  });
  instantiationService.invokeFunction((accessor) => {
    const configurationService = accessor.get($kl);
    if ($l) {
      if (configurationService.getValue("security.restrictUNCAccess") === false) {
        $Bt();
      } else {
        $zt(configurationService.getValue("security.allowedUNCHosts"));
      }
    }
  });
  instantiationService.invokeFunction((accessor) => {
    const logService = accessor.get($wn);
    if ($l && process.env.HOMEDRIVE && process.env.HOMEPATH) {
      const homeDirModulesPath = $nc(process.env.HOMEDRIVE, "node_modules");
      const userDir = $qc($nc(process.env.HOMEDRIVE, process.env.HOMEPATH));
      const userDirModulesPath = $nc(userDir, "node_modules");
      if (fs12.existsSync(homeDirModulesPath) || fs12.existsSync(userDirModulesPath)) {
        const message = `

*
* !!!! Server terminated due to presence of CVE-2020-1416 !!!!
*
* Please remove the following directories and re-try
* ${homeDirModulesPath}
* ${userDirModulesPath}
*
* For more information on the vulnerability https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-1416
*

`;
        logService.warn(message);
        console.warn(message);
        process.exit(0);
      }
    }
  });
  const vsdaMod = instantiationService.invokeFunction((accessor) => {
    const logService = accessor.get($wn);
    const hasVSDA = fs12.existsSync($nc($ih.asFileUri("").fsPath, "../node_modules/vsda"));
    if (hasVSDA) {
      try {
        return require5("vsda");
      } catch (err) {
        logService.error(err);
      }
    }
    return null;
  });
  let serverBasePath = args["server-base-path"];
  if (serverBasePath && !serverBasePath.startsWith("/")) {
    serverBasePath = `/${serverBasePath}`;
  }
  const hasWebClient = fs12.existsSync($ih.asFileUri(`vs/code/browser/workbench/workbench.html`).fsPath);
  if (hasWebClient && address && typeof address !== "string") {
    const queryPart = connectionToken.type !== 0 ? `?${$ah}=${encodeURIComponent(connectionToken.value)}` : "";
    const useSSL = args["cert"] && args["cert-key"] ? true : false;
    console.log(`Web UI available at http${useSSL ? "s" : ""}://localhost${useSSL ? address.port === 443 ? "" : `:${address.port}` : address.port === 80 ? "" : `:${address.port}`}/${queryPart}`);
    if ($WY) {
      instantiationService.invokeFunction(async (accessor) => {
        const pwbHeartbeatService = accessor.get($6Y);
        pwbHeartbeatService.sendInitialHeartbeat();
      });
    }
  }
  const remoteExtensionHostAgentServer = instantiationService.createInstance(RemoteExtensionHostAgentServer, socketServer, connectionToken, vsdaMod, hasWebClient, serverBasePath);
  $S("code/server/ready");
  const currentTime = performance2.now();
  const vscodeServerStartTime = global.vscodeServerStartTime;
  const vscodeServerListenTime = global.vscodeServerListenTime;
  const vscodeServerCodeLoadedTime = global.vscodeServerCodeLoadedTime;
  instantiationService.invokeFunction(async (accessor) => {
    const telemetryService = accessor.get($zv);
    telemetryService.publicLog2("serverStart", {
      startTime: vscodeServerStartTime,
      startedTime: vscodeServerListenTime,
      codeLoadedTime: vscodeServerCodeLoadedTime,
      readyTime: currentTime
    });
    if ($n) {
      const logService = accessor.get($wn);
      const releaseInfo = await $KW(logService.error.bind(logService));
      if (releaseInfo) {
        telemetryService.publicLog2("serverPlatformInfo", {
          platformId: releaseInfo.id,
          platformVersionId: releaseInfo.version_id,
          platformIdLike: releaseInfo.id_like
        });
      }
    }
  });
  if (args["print-startup-performance"]) {
    let output = "";
    output += `Start-up time: ${vscodeServerListenTime - vscodeServerStartTime}
`;
    output += `Code loading time: ${vscodeServerCodeLoadedTime - vscodeServerStartTime}
`;
    output += `Initialized time: ${currentTime - vscodeServerStartTime}
`;
    output += `
`;
    console.log(output);
  }
  return remoteExtensionHostAgentServer;
}
var require5, SHUTDOWN_TIMEOUT, RemoteExtensionHostAgentServer, WebEndpointOriginChecker;
var init_remoteExtensionHostAgentServer = __esm({
  "out-build/vs/server/node/remoteExtensionHostAgentServer.js"() {
    "use strict";
    init_buffer();
    init_errors();
    init_extpath();
    init_lifecycle();
    init_network();
    init_path();
    init_performance();
    init_platform();
    init_strings();
    init_uri();
    init_uuid();
    init_osReleaseInfo();
    init_ports();
    init_unc();
    init_ipc_net();
    init_ipc_net2();
    init_configuration();
    init_instantiation();
    init_log();
    init_productService();
    init_telemetry();
    init_extensionHostConnection();
    init_remoteExtensionManagement();
    init_serverConnectionToken();
    init_serverEnvironmentService();
    init_serverServices();
    init_webClientServer();
    init_pwbConstants();
    init_pwbHeartbeat();
    require5 = createRequire4(import.meta.url);
    SHUTDOWN_TIMEOUT = 5 * 60 * 1e3;
    RemoteExtensionHostAgentServer = class RemoteExtensionHostAgentServer2 extends $3c {
      constructor(n, r, s, hasWebClient, serverBasePath, t, u, w, y) {
        super();
        this.n = n;
        this.r = r;
        this.s = s;
        this.t = t;
        this.u = u;
        this.w = w;
        this.y = y;
        this.h = WebEndpointOriginChecker.create(this.u);
        this.j = $ch(u, serverBasePath);
        this.a = /* @__PURE__ */ Object.create(null);
        this.b = /* @__PURE__ */ Object.create(null);
        this.f = /* @__PURE__ */ new Set();
        this.g = hasWebClient ? this.y.createInstance($_Y, this.r, serverBasePath ?? "/", this.j) : null;
        this.w.info(`Extension host agent started.`);
        this.L(true);
      }
      async handleRequest(req, res) {
        if (!req.url) {
          return $0Y(req, res, 400, `Bad request.`);
        }
        const parsedUrl = url2.parse(req.url, true);
        let pathname = parsedUrl.pathname;
        if (!pathname) {
          return $0Y(req, res, 400, `Bad request.`);
        }
        if (req.method !== "GET") {
          if (this.g && $2Y.test(pathname)) {
            this.g.handle(req, res, parsedUrl);
            return;
          }
          return $0Y(req, res, 405, `Unsupported method ${req.method}`);
        }
        if (pathname.startsWith(this.j) && pathname.charCodeAt(this.j.length) === 47) {
          pathname = pathname.substring(this.j.length);
        }
        if (pathname === "/version") {
          res.writeHead(200, { "Content-Type": "text/plain" });
          return void res.end(this.u.commit || "");
        }
        if (pathname === "/delay-shutdown") {
          this.N();
          res.writeHead(200);
          return void res.end("OK");
        }
        if (!$5W(this.r, req, parsedUrl)) {
          return $0Y(req, res, 403, `Forbidden.`);
        }
        if (pathname === "/vscode-remote-resource") {
          const desiredPath = parsedUrl.query["path"];
          if (typeof desiredPath !== "string") {
            return $0Y(req, res, 400, `Bad request.`);
          }
          let filePath;
          try {
            filePath = URI.from({ scheme: Schemas.file, path: desiredPath }).fsPath;
          } catch (err) {
            return $0Y(req, res, 400, `Bad request.`);
          }
          const responseHeaders = /* @__PURE__ */ Object.create(null);
          if (this.t.isBuilt) {
            if ($Zg(filePath, this.t.builtinExtensionsPath, !$n) || $Zg(filePath, this.t.extensionsPath, !$n)) {
              responseHeaders["Cache-Control"] = "public, max-age=31536000";
            }
          }
          responseHeaders["Vary"] = "Origin";
          const requestOrigin = req.headers["origin"];
          if (requestOrigin && this.h.matches(requestOrigin)) {
            responseHeaders["Access-Control-Allow-Origin"] = requestOrigin;
          }
          return $$Y(filePath, 1, this.w, req, res, responseHeaders);
        }
        if (this.g) {
          this.g.handle(req, res, parsedUrl);
          return;
        }
        res.writeHead(404, { "Content-Type": "text/plain" });
        return void res.end("Not found");
      }
      // PWB Modify Start: Add upgradedHead parameter to handleUpgrade for server proxy support
      handleUpgrade(req, socket, upgradeHead) {
        let reconnectionToken = $ps();
        let isReconnection = false;
        let skipWebSocketFrames = false;
        let pathname = null;
        if (req.url) {
          const query = url2.parse(req.url, true).query;
          if (typeof query.reconnectionToken === "string") {
            reconnectionToken = query.reconnectionToken;
          }
          if (query.reconnection === "true") {
            isReconnection = true;
          }
          if (query.skipWebSocketFrames === "true") {
            skipWebSocketFrames = true;
          }
          pathname = url2.parse(req.url, true).pathname;
        }
        if (req.headers["upgrade"] === void 0 || req.headers["upgrade"].toLowerCase() !== "websocket") {
          socket.end("HTTP/1.1 400 Bad Request");
          return;
        }
        if (pathname) {
          if (this.g && $2Y.test(pathname)) {
            this.g.handleUpgrade(req, socket, upgradeHead, pathname);
            return;
          }
        }
        const requestNonce = req.headers["sec-websocket-key"];
        const hash = crypto3.createHash("sha1");
        hash.update(requestNonce + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
        const responseNonce = hash.digest("base64");
        const responseHeaders = [
          `HTTP/1.1 101 Switching Protocols`,
          `Upgrade: websocket`,
          `Connection: Upgrade`,
          `Sec-WebSocket-Accept: ${responseNonce}`
        ];
        let permessageDeflate = false;
        if (!skipWebSocketFrames && !this.t.args["disable-websocket-compression"] && req.headers["sec-websocket-extensions"]) {
          const websocketExtensionOptions = Array.isArray(req.headers["sec-websocket-extensions"]) ? req.headers["sec-websocket-extensions"] : [req.headers["sec-websocket-extensions"]];
          for (const websocketExtensionOption of websocketExtensionOptions) {
            if (/\b((server_max_window_bits)|(server_no_context_takeover)|(client_no_context_takeover))\b/.test(websocketExtensionOption)) {
              continue;
            }
            if (/\b(permessage-deflate)\b/.test(websocketExtensionOption)) {
              permessageDeflate = true;
              responseHeaders.push(`Sec-WebSocket-Extensions: permessage-deflate`);
              break;
            }
            if (/\b(x-webkit-deflate-frame)\b/.test(websocketExtensionOption)) {
              permessageDeflate = true;
              responseHeaders.push(`Sec-WebSocket-Extensions: x-webkit-deflate-frame`);
              break;
            }
          }
        }
        socket.write(responseHeaders.join("\r\n") + "\r\n\r\n");
        socket.setTimeout(0);
        socket.setNoDelay(true);
        if (skipWebSocketFrames) {
          this.D(new $uu(socket, `server-connection-${reconnectionToken}`), isReconnection, reconnectionToken);
        } else {
          this.D(new $vu(new $uu(socket, `server-connection-${reconnectionToken}`), permessageDeflate, null, true), isReconnection, reconnectionToken);
        }
      }
      handleServerError(err) {
        this.w.error(`Error occurred in server`);
        this.w.error(err);
      }
      // Eventually cleanup
      z(socket) {
        let _socket;
        if (socket instanceof $uu) {
          _socket = socket.socket;
        } else {
          _socket = socket.socket.socket;
        }
        return _socket.remoteAddress || `<unknown>`;
      }
      async C(logPrefix, protocol, reason) {
        const socket = protocol.getSocket();
        this.w.error(`${logPrefix} ${reason}.`);
        const errMessage = {
          type: "error",
          reason
        };
        protocol.sendControl($Ci.fromString(JSON.stringify(errMessage)));
        protocol.dispose();
        await socket.drain();
        socket.dispose();
      }
      /**
       * NOTE: Avoid using await in this method!
       * The problem is that await introduces a process.nextTick due to the implicit Promise.then
       * This can lead to some bytes being received and interpreted and a control message being emitted before the next listener has a chance to be registered.
       */
      D(socket, isReconnection, reconnectionToken) {
        const remoteAddress = this.z(socket);
        const logPrefix = `[${remoteAddress}][${reconnectionToken.substr(0, 8)}]`;
        const protocol = new $tu({ socket });
        const validator = this.s ? new this.s.validator() : null;
        const signer = this.s ? new this.s.signer() : null;
        let State2;
        (function(State3) {
          State3[State3["WaitingForAuth"] = 0] = "WaitingForAuth";
          State3[State3["WaitingForConnectionType"] = 1] = "WaitingForConnectionType";
          State3[State3["Done"] = 2] = "Done";
          State3[State3["Error"] = 3] = "Error";
        })(State2 || (State2 = {}));
        let state = 0;
        const rejectWebSocketConnection = (msg) => {
          state = 3;
          listener.dispose();
          this.C(logPrefix, protocol, msg);
        };
        const listener = protocol.onControlMessage((raw) => {
          if (state === 0) {
            let msg1;
            try {
              msg1 = JSON.parse(raw.toString());
            } catch (err) {
              return rejectWebSocketConnection(`Malformed first message`);
            }
            if (msg1.type !== "auth") {
              return rejectWebSocketConnection(`Invalid first message`);
            }
            if (this.r.type === 2 && !this.r.validate(msg1.auth)) {
              return rejectWebSocketConnection(`Unauthorized client refused: auth mismatch`);
            }
            let signedData = $ps();
            if (signer) {
              try {
                signedData = signer.sign(msg1.data);
              } catch (e) {
              }
            }
            let someText = $ps();
            if (validator) {
              try {
                someText = validator.createNewMessage(someText);
              } catch (e) {
              }
            }
            const signRequest = {
              type: "sign",
              data: someText,
              signedData
            };
            protocol.sendControl($Ci.fromString(JSON.stringify(signRequest)));
            state = 1;
          } else if (state === 1) {
            let msg2;
            try {
              msg2 = JSON.parse(raw.toString());
            } catch (err) {
              return rejectWebSocketConnection(`Malformed second message`);
            }
            if (msg2.type !== "connectionType") {
              return rejectWebSocketConnection(`Invalid second message`);
            }
            if (typeof msg2.signedData !== "string") {
              return rejectWebSocketConnection(`Invalid second message field type`);
            }
            const rendererCommit = msg2.commit;
            const myCommit = this.u.commit;
            if (rendererCommit && myCommit) {
              if (rendererCommit !== myCommit) {
                return rejectWebSocketConnection(`Client refused: version mismatch`);
              }
            }
            let valid2 = false;
            if (!validator) {
              valid2 = true;
            } else if (this.r.validate(msg2.signedData)) {
              valid2 = true;
            } else {
              try {
                valid2 = validator.validate(msg2.signedData) === "ok";
              } catch (e) {
              }
            }
            if (!valid2) {
              if (this.t.isBuilt) {
                return rejectWebSocketConnection(`Unauthorized client refused`);
              } else {
                this.w.error(`${logPrefix} Unauthorized client handshake failed but we proceed because of dev mode.`);
              }
            }
            for (const key in this.b) {
              const managementConnection = this.b[key];
              managementConnection.shortenReconnectionGraceTimeIfNecessary();
            }
            for (const key in this.a) {
              const extHostConnection = this.a[key];
              extHostConnection.shortenReconnectionGraceTimeIfNecessary();
            }
            state = 2;
            listener.dispose();
            this.F(remoteAddress, logPrefix, protocol, socket, isReconnection, reconnectionToken, msg2);
          }
        });
      }
      async F(remoteAddress, _logPrefix, protocol, socket, isReconnection, reconnectionToken, msg) {
        const logPrefix = msg.desiredConnectionType === 1 ? `${_logPrefix}[ManagementConnection]` : msg.desiredConnectionType === 2 ? `${_logPrefix}[ExtensionHostConnection]` : _logPrefix;
        if (msg.desiredConnectionType === 1) {
          if (isReconnection) {
            if (!this.b[reconnectionToken]) {
              if (!this.f.has(reconnectionToken)) {
                return this.C(logPrefix, protocol, `Unknown reconnection token (never seen)`);
              } else {
                return this.C(logPrefix, protocol, `Unknown reconnection token (seen before)`);
              }
            }
            protocol.sendControl($Ci.fromString(JSON.stringify({ type: "ok" })));
            const dataChunk = protocol.readEntireBuffer();
            protocol.dispose();
            this.b[reconnectionToken].acceptReconnection(remoteAddress, socket, dataChunk);
          } else {
            if (this.b[reconnectionToken]) {
              return this.C(logPrefix, protocol, `Duplicate reconnection token`);
            }
            protocol.sendControl($Ci.fromString(JSON.stringify({ type: "ok" })));
            const con = new $YW(this.w, reconnectionToken, remoteAddress, protocol);
            this.n.acceptConnection(con.protocol, con.onClose);
            this.b[reconnectionToken] = con;
            this.f.add(reconnectionToken);
            con.onClose(() => {
              delete this.b[reconnectionToken];
            });
          }
        } else if (msg.desiredConnectionType === 2) {
          const startParams0 = msg.args || { language: "en" };
          const startParams = await this.I(startParams0);
          if (startParams.port) {
            this.w.trace(`${logPrefix} - startParams debug port ${startParams.port}`);
          }
          this.w.trace(`${logPrefix} - startParams language: ${startParams.language}`);
          this.w.trace(`${logPrefix} - startParams env: ${JSON.stringify(startParams.env)}`);
          if (isReconnection) {
            if (!this.a[reconnectionToken]) {
              if (!this.f.has(reconnectionToken)) {
                return this.C(logPrefix, protocol, `Unknown reconnection token (never seen)`);
              } else {
                return this.C(logPrefix, protocol, `Unknown reconnection token (seen before)`);
              }
            }
            protocol.sendPause();
            protocol.sendControl($Ci.fromString(JSON.stringify(startParams.port ? { debugPort: startParams.port } : {})));
            const dataChunk = protocol.readEntireBuffer();
            protocol.dispose();
            this.a[reconnectionToken].acceptReconnection(remoteAddress, socket, dataChunk);
          } else {
            if (this.a[reconnectionToken]) {
              return this.C(logPrefix, protocol, `Duplicate reconnection token`);
            }
            protocol.sendPause();
            protocol.sendControl($Ci.fromString(JSON.stringify(startParams.port ? { debugPort: startParams.port } : {})));
            const dataChunk = protocol.readEntireBuffer();
            protocol.dispose();
            const con = this.y.createInstance($XW, reconnectionToken, remoteAddress, socket, dataChunk);
            this.a[reconnectionToken] = con;
            this.f.add(reconnectionToken);
            con.onClose(() => {
              con.dispose();
              delete this.a[reconnectionToken];
              this.J();
            });
            con.start(startParams);
          }
        } else if (msg.desiredConnectionType === 3) {
          const tunnelStartParams = msg.args;
          this.G(protocol, tunnelStartParams);
        } else {
          return this.C(logPrefix, protocol, `Unknown initial data received`);
        }
      }
      async G(protocol, tunnelStartParams) {
        const remoteSocket = protocol.getSocket().socket;
        const dataChunk = protocol.readEntireBuffer();
        protocol.dispose();
        remoteSocket.pause();
        const localSocket = await this.H(tunnelStartParams.host, tunnelStartParams.port);
        if (dataChunk.byteLength > 0) {
          localSocket.write(dataChunk.buffer);
        }
        localSocket.on("end", () => remoteSocket.end());
        localSocket.on("close", () => remoteSocket.end());
        localSocket.on("error", () => remoteSocket.destroy());
        remoteSocket.on("end", () => localSocket.end());
        remoteSocket.on("close", () => localSocket.end());
        remoteSocket.on("error", () => localSocket.destroy());
        localSocket.pipe(remoteSocket);
        remoteSocket.pipe(localSocket);
      }
      H(host, port) {
        return new Promise((c, e) => {
          const socket = net3.createConnection({
            host,
            port,
            autoSelectFamily: true
          }, () => {
            socket.removeListener("error", e);
            socket.pause();
            c(socket);
          });
          socket.once("error", e);
        });
      }
      I(startParams) {
        if (typeof startParams.port === "number") {
          return $Zs(
            startParams.port,
            10,
            5e3
            /* try up to 5 seconds */
          ).then((freePort) => {
            startParams.port = freePort;
            return startParams;
          });
        }
        startParams.debugId = void 0;
        startParams.port = void 0;
        startParams.break = void 0;
        return Promise.resolve(startParams);
      }
      async J() {
        if (!this.t.args["enable-remote-auto-shutdown"]) {
          return;
        }
        this.O();
        const hasActiveExtHosts = !!Object.keys(this.a).length;
        if (!hasActiveExtHosts) {
          console.log("Last EH closed, waiting before shutting down");
          this.w.info("Last EH closed, waiting before shutting down");
          this.L();
        }
      }
      L(initial = false) {
        if (!this.t.args["enable-remote-auto-shutdown"]) {
          return;
        }
        if (this.t.args["remote-auto-shutdown-without-delay"] && !initial) {
          this.M();
        } else {
          this.m = setTimeout(() => {
            this.m = void 0;
            this.M();
          }, SHUTDOWN_TIMEOUT);
        }
      }
      M() {
        const hasActiveExtHosts = !!Object.keys(this.a).length;
        if (hasActiveExtHosts) {
          console.log("New EH opened, aborting shutdown");
          this.w.info("New EH opened, aborting shutdown");
          return;
        } else {
          console.log("Last EH closed, shutting down");
          this.w.info("Last EH closed, shutting down");
          this.dispose();
          process.exit(0);
        }
      }
      /**
       * If the server is in a shutdown timeout, cancel it and start over
       */
      N() {
        if (this.m) {
          console.log("Got delay-shutdown request while in shutdown timeout, delaying");
          this.w.info("Got delay-shutdown request while in shutdown timeout, delaying");
          this.O();
          this.L();
        }
      }
      O() {
        if (this.m) {
          console.log("Cancelling previous shutdown timeout");
          this.w.info("Cancelling previous shutdown timeout");
          clearTimeout(this.m);
          this.m = void 0;
        }
      }
    };
    RemoteExtensionHostAgentServer = __decorate([
      __param(5, $PW),
      __param(6, $Vu),
      __param(7, $wn),
      __param(8, $Pk)
    ], RemoteExtensionHostAgentServer);
    WebEndpointOriginChecker = class _WebEndpointOriginChecker {
      static create(productService) {
        const webEndpointUrlTemplate = productService.webEndpointUrlTemplate;
        const commit = productService.commit;
        const quality = productService.quality;
        if (!webEndpointUrlTemplate || !commit || !quality) {
          return new _WebEndpointOriginChecker(null);
        }
        const uuid = $ps();
        const exampleUrl = new URL(webEndpointUrlTemplate.replace("{{uuid}}", uuid).replace("{{commit}}", commit).replace("{{quality}}", quality));
        const exampleOrigin = exampleUrl.origin;
        const originRegExpSource = $Af(exampleOrigin).replace(uuid, "[a-zA-Z0-9\\-]+");
        try {
          const originRegExp = $Jf(`^${originRegExpSource}$`, true, { matchCase: false });
          return new _WebEndpointOriginChecker(originRegExp);
        } catch (err) {
          return new _WebEndpointOriginChecker(null);
        }
      }
      constructor(a) {
        this.a = a;
      }
      matches(origin) {
        if (!this.a) {
          return false;
        }
        return this.a.test(origin);
      }
    };
  }
});

// out-build/vs/server/node/server.main.js
var server_main_exports = {};
__export(server_main_exports, {
  $gZ: () => $gZ,
  $hZ: () => $hZ
});
import * as os5 from "os";
import * as fs13 from "fs";
import { performance as performance3 } from "perf_hooks";
function parse5() {
  return $jt(process.argv.slice(2), $OW, errorReporter);
}
function createDirs(args) {
  const REMOTE_DATA_FOLDER = args["server-data-dir"] || args["user-data-dir"] || process.env["VSCODE_AGENT_FOLDER"] || $nc(os5.homedir(), product_default.serverDataFolderName || ".vscode-remote");
  const USER_DATA_PATH = args["user-data-dir"] || $nc(REMOTE_DATA_FOLDER, "data");
  const APP_SETTINGS_HOME = $nc(USER_DATA_PATH, "User");
  const GLOBAL_STORAGE_HOME = $nc(APP_SETTINGS_HOME, "globalStorage");
  const LOCAL_HISTORY_HOME = $nc(APP_SETTINGS_HOME, "History");
  const MACHINE_SETTINGS_HOME = $nc(USER_DATA_PATH, "Machine");
  args["user-data-dir"] = USER_DATA_PATH;
  const APP_ROOT2 = $qc($ih.asFileUri("").fsPath);
  const BUILTIN_EXTENSIONS_FOLDER_PATH = $nc(APP_ROOT2, "extensions");
  args["builtin-extensions-dir"] = BUILTIN_EXTENSIONS_FOLDER_PATH;
  args["extensions-dir"] = args["extensions-dir"] || $nc(REMOTE_DATA_FOLDER, "extensions");
  [REMOTE_DATA_FOLDER, args["extensions-dir"], USER_DATA_PATH, APP_SETTINGS_HOME, MACHINE_SETTINGS_HOME, GLOBAL_STORAGE_HOME, LOCAL_HISTORY_HOME].forEach((f) => {
    try {
      if (!fs13.existsSync(f)) {
        fs13.mkdirSync(f, { mode: 448 });
      }
    } catch (err) {
      console.error(err);
    }
  });
  return REMOTE_DATA_FOLDER;
}
function $gZ(args = parse5()) {
  run(args, createDirs(args), $OW);
}
function $hZ(address, args = parse5()) {
  return $dZ(address, args, createDirs(args));
}
var errorReporter;
var init_server_main = __esm({
  "out-build/vs/server/node/server.main.js"() {
    "use strict";
    init_network();
    init_remoteExtensionHostAgentCli();
    init_remoteExtensionHostAgentServer();
    init_argv();
    init_path();
    init_serverEnvironmentService();
    init_product();
    init_performance();
    $S("code/server/codeLoaded");
    global.vscodeServerCodeLoadedTime = performance3.now();
    errorReporter = {
      onMultipleValues: (id2, usedValue) => {
        console.error(`Option '${id2}' can only be defined once. Using value ${usedValue}.`);
      },
      onEmptyValue: (id2) => {
        console.error(`Ignoring option '${id2}': Value must not be empty.`);
      },
      onUnknownOption: (id2) => {
        console.error(`Ignoring option '${id2}': not supported for server.`);
      },
      onDeprecatedOption: (deprecatedOption, message) => {
        console.warn(`Option '${deprecatedOption}' is deprecated: ${message}`);
      }
    };
  }
});

// out-build/bootstrap-server.js
delete process.env["ELECTRON_RUN_AS_NODE"];

// out-build/server-main.js
var import_minimist2 = __toESM(require_minimist(), 1);
import * as path6 from "path";
import * as http2 from "http";
import * as os6 from "os";
import * as readline from "readline";
import { performance as performance4 } from "perf_hooks";
import { fileURLToPath as fileURLToPath3 } from "url";

// out-build/bootstrap-node.js
import * as path from "path";
import * as fs from "fs";
import { fileURLToPath } from "url";
import { createRequire } from "node:module";
var require2 = createRequire(import.meta.url);
var __dirname = path.dirname(fileURLToPath(import.meta.url));
Error.stackTraceLimit = 100;
if (!process.env["VSCODE_HANDLES_SIGPIPE"]) {
  let didLogAboutSIGPIPE = false;
  process.on("SIGPIPE", () => {
    if (!didLogAboutSIGPIPE) {
      didLogAboutSIGPIPE = true;
      console.error(new Error(`Unexpected SIGPIPE`));
    }
  });
}
function setupCurrentWorkingDirectory() {
  try {
    if (typeof process.env["VSCODE_CWD"] !== "string") {
      process.env["VSCODE_CWD"] = process.cwd();
    }
    if (process.platform === "win32") {
      process.chdir(path.dirname(process.execPath));
    }
  } catch (err) {
    console.error(err);
  }
}
setupCurrentWorkingDirectory();
function $P(injectPath) {
  if (!process.env["VSCODE_DEV"]) {
    return;
  }
  if (!injectPath) {
    throw new Error("Missing injectPath");
  }
  const Module = require2("node:module");
  Module.register("./bootstrap-import.js", { parentURL: import.meta.url, data: injectPath });
}

// out-build/bootstrap-esm.js
import * as path2 from "path";
import * as fs2 from "fs";
import { fileURLToPath as fileURLToPath2 } from "url";
import { createRequire as createRequire3, register } from "node:module";

// out-build/bootstrap-meta.js
import { createRequire as createRequire2 } from "node:module";
var require3 = createRequire2(import.meta.url);
var productObj = { BUILD_INSERT_PRODUCT_CONFIGURATION: "BUILD_INSERT_PRODUCT_CONFIGURATION" };
if (productObj["BUILD_INSERT_PRODUCT_CONFIGURATION"]) {
  productObj = require3("../product.json");
}
var pkgObj = { BUILD_INSERT_PACKAGE_CONFIGURATION: "BUILD_INSERT_PACKAGE_CONFIGURATION" };
if (pkgObj["BUILD_INSERT_PACKAGE_CONFIGURATION"]) {
  pkgObj = require3("../package.json");
}
var $N = productObj;
var $O = pkgObj;

// out-build/bootstrap-esm.js
init_performance();
var require4 = createRequire3(import.meta.url);
var __dirname2 = path2.dirname(fileURLToPath2(import.meta.url));
if (process.env["ELECTRON_RUN_AS_NODE"] || process.versions["electron"]) {
  const jsCode = `
	export async function resolve(specifier, context, nextResolve) {
		if (specifier === 'fs') {
			return {
				format: 'builtin',
				shortCircuit: true,
				url: 'node:original-fs'
			};
		}

		// Defer to the next hook in the chain, which would be the
		// Node.js default resolve if this is the last user-specified loader.
		return nextResolve(specifier, context);
	}`;
  register(`data:text/javascript;base64,${Buffer.from(jsCode).toString("base64")}`, import.meta.url);
}
globalThis._VSCODE_PRODUCT_JSON = { ...$N };
if (process.env["VSCODE_DEV"]) {
  try {
    const overrides = require4("../product.overrides.json");
    globalThis._VSCODE_PRODUCT_JSON = Object.assign(globalThis._VSCODE_PRODUCT_JSON, overrides);
  } catch (error) {
  }
}
globalThis._VSCODE_PACKAGE_JSON = { ...$O };
globalThis._VSCODE_FILE_ROOT = __dirname2;
var setupNLSResult = void 0;
function setupNLS() {
  if (!setupNLSResult) {
    setupNLSResult = doSetupNLS();
  }
  return setupNLSResult;
}
async function doSetupNLS() {
  $S("code/willLoadNls");
  let nlsConfig = void 0;
  let messagesFile;
  if (process.env["VSCODE_NLS_CONFIG"]) {
    try {
      nlsConfig = JSON.parse(process.env["VSCODE_NLS_CONFIG"]);
      if (nlsConfig?.languagePack?.messagesFile) {
        messagesFile = nlsConfig.languagePack.messagesFile;
      } else if (nlsConfig?.defaultMessagesFile) {
        messagesFile = nlsConfig.defaultMessagesFile;
      }
      globalThis._VSCODE_NLS_LANGUAGE = nlsConfig?.resolvedLanguage;
    } catch (e) {
      console.error(`Error reading VSCODE_NLS_CONFIG from environment: ${e}`);
    }
  }
  if (process.env["VSCODE_DEV"] || // no NLS support in dev mode
  !messagesFile) {
    return void 0;
  }
  try {
    globalThis._VSCODE_NLS_MESSAGES = JSON.parse((await fs2.promises.readFile(messagesFile)).toString());
  } catch (error) {
    console.error(`Error reading NLS messages file ${messagesFile}: ${error}`);
    if (nlsConfig?.languagePack?.corruptMarkerFile) {
      try {
        await fs2.promises.writeFile(nlsConfig.languagePack.corruptMarkerFile, "corrupted");
      } catch (error2) {
        console.error(`Error writing corrupted NLS marker file: ${error2}`);
      }
    }
    if (nlsConfig?.defaultMessagesFile && nlsConfig.defaultMessagesFile !== messagesFile) {
      try {
        globalThis._VSCODE_NLS_MESSAGES = JSON.parse((await fs2.promises.readFile(nlsConfig.defaultMessagesFile)).toString());
      } catch (error2) {
        console.error(`Error reading default NLS messages file ${nlsConfig.defaultMessagesFile}: ${error2}`);
      }
    }
  }
  $S("code/didLoadNls");
  return nlsConfig;
}
async function $U() {
  await setupNLS();
}

// out-build/server-main.js
init_nls();
init_performance();
import * as fs14 from "fs";
import * as https2 from "https";
var __dirname3 = path6.dirname(fileURLToPath3(import.meta.url));
$S("code/server/start");
globalThis.vscodeServerStartTime = performance4.now();
var parsedArgs = (0, import_minimist2.default)(process.argv.slice(2), {
  boolean: ["start-server", "list-extensions", "print-ip-address", "help", "version", "accept-server-license-terms", "update-extensions"],
  // --- Start PWB ---
  // PWB: adding cert and cert-key options to string arg list
  string: ["install-extension", "install-builtin-extension", "uninstall-extension", "locate-extension", "socket-path", "host", "port", "compatibility", "cert-key", "cert"],
  // --- End PWB ---
  alias: { help: "h", version: "v" }
});
["host", "port", "accept-server-license-terms"].forEach((e) => {
  if (!parsedArgs[e]) {
    const envValue = process.env[`VSCODE_SERVER_${e.toUpperCase().replace("-", "_")}`];
    if (envValue) {
      parsedArgs[e] = envValue;
    }
  }
});
var extensionLookupArgs = ["list-extensions", "locate-extension"];
var extensionInstallArgs = ["install-extension", "install-builtin-extension", "uninstall-extension", "update-extensions"];
var shouldSpawnCli = parsedArgs.help || parsedArgs.version || extensionLookupArgs.some((a) => !!parsedArgs[a]) || extensionInstallArgs.some((a) => !!parsedArgs[a]) && !parsedArgs["start-server"];
var nlsConfiguration = await $Os({ userLocale: "en", osLocale: "en", commit: $N.commit, userDataPath: "", nlsMetadataPath: __dirname3 });
if (shouldSpawnCli) {
  loadCode(nlsConfiguration).then((mod) => {
    mod.$gZ();
  });
} else {
  let _remoteExtensionHostAgentServer = null;
  let _remoteExtensionHostAgentServerPromise = null;
  const getRemoteExtensionHostAgentServer = () => {
    if (!_remoteExtensionHostAgentServerPromise) {
      _remoteExtensionHostAgentServerPromise = loadCode(nlsConfiguration).then(async (mod) => {
        const server2 = await mod.$hZ(address);
        _remoteExtensionHostAgentServer = server2;
        return server2;
      });
    }
    return _remoteExtensionHostAgentServerPromise;
  };
  if (Array.isArray($N.serverLicense) && $N.serverLicense.length) {
    console.log($N.serverLicense.join("\n"));
    if ($N.serverLicensePrompt && parsedArgs["accept-server-license-terms"] !== true) {
      if (hasStdinWithoutTty()) {
        console.log("To accept the license terms, start the server with --accept-server-license-terms");
        process.exit(1);
      }
      try {
        const accept = await prompt($N.serverLicensePrompt);
        if (!accept) {
          process.exit(1);
        }
      } catch (e) {
        console.log(e);
        process.exit(1);
      }
    }
  }
  let firstRequest = true;
  let firstWebSocket = true;
  let address = null;
  const useSSL = parsedArgs["cert-key"] && parsedArgs["cert"] ? true : false;
  const server = (useSSL ? https2 : http2).createServer(useSSL ? {
    key: fs14.readFileSync(parsedArgs["cert-key"]),
    cert: fs14.readFileSync(parsedArgs["cert"])
    // @ts-ignore req/res types not inferred
  } : {}, async (req, res) => {
    if (firstRequest) {
      firstRequest = false;
      $S("code/server/firstRequest");
    }
    const remoteExtensionHostAgentServer = await getRemoteExtensionHostAgentServer();
    return remoteExtensionHostAgentServer.handleRequest(req, res);
  });
  server.on("upgrade", async (req, socket, upgradeHead) => {
    if (firstWebSocket) {
      firstWebSocket = false;
      $S("code/server/firstWebSocket");
    }
    const remoteExtensionHostAgentServer = await getRemoteExtensionHostAgentServer();
    return remoteExtensionHostAgentServer.handleUpgrade(req, socket, upgradeHead);
  });
  server.on("error", async (err) => {
    const remoteExtensionHostAgentServer = await getRemoteExtensionHostAgentServer();
    return remoteExtensionHostAgentServer.handleServerError(err);
  });
  const host = sanitizeStringArg(parsedArgs["host"]) || (parsedArgs["compatibility"] !== "1.63" ? "localhost" : void 0);
  const nodeListenOptions = parsedArgs["socket-path"] ? { path: sanitizeStringArg(parsedArgs["socket-path"]) } : { host, port: await parsePort(host, sanitizeStringArg(parsedArgs["port"])) };
  server.listen(nodeListenOptions, async () => {
    let output = Array.isArray($N.serverGreeting) && $N.serverGreeting.length ? `

${$N.serverGreeting.join("\n")}

` : ``;
    if (typeof nodeListenOptions.port === "number" && parsedArgs["print-ip-address"]) {
      const ifaces = os6.networkInterfaces();
      Object.keys(ifaces).forEach(function(ifname) {
        ifaces[ifname]?.forEach(function(iface) {
          if (!iface.internal && iface.family === "IPv4") {
            output += `IP Address: ${iface.address}
`;
          }
        });
      });
    }
    address = server.address();
    if (address === null) {
      throw new Error("Unexpected server address");
    }
    output += `Server bound to ${typeof address === "string" ? address : `${address.address}:${address.port} (${address.family})`}
`;
    output += `Extension host agent listening on ${typeof address === "string" ? address : address.port}
`;
    console.log(output);
    $S("code/server/started");
    globalThis.vscodeServerListenTime = performance4.now();
    await getRemoteExtensionHostAgentServer();
  });
  process.on("exit", () => {
    server.close();
    if (_remoteExtensionHostAgentServer) {
      _remoteExtensionHostAgentServer.dispose();
    }
  });
}
function sanitizeStringArg(val) {
  if (Array.isArray(val)) {
    val = val.pop();
  }
  return typeof val === "string" ? val : void 0;
}
async function parsePort(host, strPort) {
  if (strPort) {
    let range;
    if (strPort.match(/^\d+$/)) {
      return parseInt(strPort, 10);
    } else if (range = parseRange(strPort)) {
      const port = await findFreePort(host, range.start, range.end);
      if (port !== void 0) {
        return port;
      }
      console.warn(`--port: Could not find free port in range: ${range.start} - ${range.end} (inclusive).`);
      process.exit(1);
    } else {
      console.warn(`--port "${strPort}" is not a valid number or range. Ranges must be in the form 'from-to' with 'from' an integer larger than 0 and not larger than 'end'.`);
      process.exit(1);
    }
  }
  return 8e3;
}
function parseRange(strRange) {
  const match = strRange.match(/^(\d+)-(\d+)$/);
  if (match) {
    const start = parseInt(match[1], 10), end = parseInt(match[2], 10);
    if (start > 0 && start <= end && end <= 65535) {
      return { start, end };
    }
  }
  return void 0;
}
async function findFreePort(host, start, end) {
  const testPort = (port) => {
    return new Promise((resolve4) => {
      const server = http2.createServer();
      server.listen(port, host, () => {
        server.close();
        resolve4(true);
      }).on("error", () => {
        resolve4(false);
      });
    });
  };
  for (let port = start; port <= end; port++) {
    if (await testPort(port)) {
      return port;
    }
  }
  return void 0;
}
async function loadCode(nlsConfiguration2) {
  process.env["VSCODE_NLS_CONFIG"] = JSON.stringify(nlsConfiguration2);
  process.env["VSCODE_HANDLES_SIGPIPE"] = "true";
  if (process.env["VSCODE_DEV"]) {
    process.env["VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH"] = process.env["VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH"] || path6.join(__dirname3, "..", "remote", "node_modules");
    $P(process.env["VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH"]);
  } else {
    delete process.env["VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH"];
  }
  await $U();
  return Promise.resolve().then(() => (init_server_main(), server_main_exports));
}
function hasStdinWithoutTty() {
  try {
    return !process.stdin.isTTY;
  } catch (error) {
  }
  return false;
}
function prompt(question) {
  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });
  return new Promise((resolve4, reject) => {
    rl.question(question + " ", async function(data) {
      rl.close();
      const str = data.toString().trim().toLowerCase();
      if (str === "" || str === "y" || str === "yes") {
        resolve4(true);
      } else if (str === "n" || str === "no") {
        resolve4(false);
      } else {
        process.stdout.write("\nInvalid Response. Answer either yes (y, yes) or no (n, no)\n");
        resolve4(await prompt(question));
      }
    });
  });
}

//# sourceMappingURL=server-main.js.map
